Explorar el Código

Added onClick function for most components

pull/1/head
Djordje Mitrovic hace 3 años
padre
commit
7b9680c3ec

+ 2
- 2
src/components/Buttons/IconButton/IconButton.styled.js Ver fichero

import { IconButton } from "@mui/material";
import { Box, IconButton } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";


export const ComponentContainer = styled.div`
export const ComponentContainer = styled(Box)`
` `


export const IconButtonStyled = styled(IconButton)` export const IconButtonStyled = styled(IconButton)`

+ 1
- 0
src/components/Buttons/LoginButton/LoginButton.js Ver fichero

containerStyle: PropTypes.any, containerStyle: PropTypes.any,
fullWidth: PropTypes.string, fullWidth: PropTypes.string,
buttonColor: PropTypes.string, buttonColor: PropTypes.string,
onClick: PropTypes.func
}; };

+ 2
- 2
src/components/Buttons/LoginButton/LoginButton.styled.js Ver fichero

import { Button } from "@mui/material";
import { Box, Button } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";




export const ComponentContainer = styled.div`
export const ComponentContainer = styled(Box)`
` `


export const LoginButtonStyled = styled(Button)` export const LoginButtonStyled = styled(Button)`

+ 1
- 0
src/components/Buttons/PrimaryButton/PrimaryButton.js Ver fichero

buttoncolor: PropTypes.string, buttoncolor: PropTypes.string,
textcolor: PropTypes.string, textcolor: PropTypes.string,
className: PropTypes.string, className: PropTypes.string,
onClick: PropTypes.func,
}; };

+ 2
- 2
src/components/Buttons/PrimaryButton/PrimaryButton.styled.js Ver fichero

import { Button } from "@mui/material";
import { Box, Button } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";
import { PRIMARY_PURPLE_DISABLED } from "../../../constants/stylesConstants"; import { PRIMARY_PURPLE_DISABLED } from "../../../constants/stylesConstants";


export const ComponentContainer = styled.div``;
export const ComponentContainer = styled(Box)``;


export const PrimaryButtonStyled = styled(Button)` export const PrimaryButtonStyled = styled(Button)`
background-color: ${(props) => background-color: ${(props) =>

+ 2
- 1
src/components/Buttons/PrimaryButtonWithIcon/PrimaryButtonWithIcon.js Ver fichero

style={props.containerStyle} style={props.containerStyle}
className={props.className} className={props.className}
> >
<PrimaryButtonWithIconStyled sx={props.style} {...props.buttonProps}>
<PrimaryButtonWithIconStyled sx={props.style} {...props.buttonProps} onClick={props.onClick}>
<IconStyled style={props.iconStyle}>{props.icon}</IconStyled> <IconStyled style={props.iconStyle}>{props.icon}</IconStyled>
{props.children} {props.children}
</PrimaryButtonWithIconStyled> </PrimaryButtonWithIconStyled>
style: PropTypes.any, style: PropTypes.any,
iconStyle: PropTypes.any, iconStyle: PropTypes.any,
buttonProps: PropTypes.any, buttonProps: PropTypes.any,
onClick: PropTypes.func,
}; };


export default PrimaryButtonWithIcon; export default PrimaryButtonWithIcon;

+ 2
- 1
src/components/Buttons/PrimaryButtonWithIcon/PrimaryButtonWithIcon.styled.js Ver fichero

import { Box } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";
import { Icon } from "../../Icon/Icon"; import { Icon } from "../../Icon/Icon";
import { PrimaryButton } from "../PrimaryButton/PrimaryButton"; import { PrimaryButton } from "../PrimaryButton/PrimaryButton";


export const ComponentContainer = styled.div``;
export const ComponentContainer = styled(Box)``;


export const PrimaryButtonWithIconStyled = styled(PrimaryButton)` export const PrimaryButtonWithIconStyled = styled(PrimaryButton)`
position: relative; position: relative;

+ 2
- 2
src/components/CheckBox/CheckBox.styled.js Ver fichero

import { Checkbox, FormControlLabel } from "@mui/material";
import { Box, Checkbox, FormControlLabel } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";


export const ComponentContainer = styled.div`
export const ComponentContainer = styled(Box)`
${props => props.fullWidth && (` ${props => props.fullWidth && (`
width: 100%; width: 100%;
display: flex; display: flex;

+ 2
- 2
src/components/CheckBox/Label.styled.js Ver fichero

import { FormLabel } from "@mui/material";
import { Box, FormLabel } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";


export const ComponentContainer = styled.div`
export const ComponentContainer = styled(Box)`
display: flex; display: flex;
flex: 1; flex: 1;
justify-content: space-between; justify-content: space-between;

+ 2
- 1
src/components/Dropdown/DropdownItem/DropdownItem.js Ver fichero



const DropdownItem = (props) => { const DropdownItem = (props) => {
return ( return (
<ComponentContainer>
<ComponentContainer onClick={props.onClick}>
<DropdownItemStyled> <DropdownItemStyled>
{props.children} {props.children}
</DropdownItemStyled> </DropdownItemStyled>


DropdownItem.propTypes = { DropdownItem.propTypes = {
children: PropTypes.node, children: PropTypes.node,
onClick: PropTypes.func,
} }


export default DropdownItem; export default DropdownItem;

+ 3
- 2
src/components/Dropdown/DropdownItem/DropdownItem.styled.js Ver fichero

import { Box } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";


export const ComponentContainer = styled.div`
export const ComponentContainer = styled(Box)`
` `


export const DropdownItemStyled = styled.div`
export const DropdownItemStyled = styled(Box)`
` `

+ 3
- 1
src/components/Dropdown/DropdownList/DropdownList.js Ver fichero

import PropTypes from "prop-types"; import PropTypes from "prop-types";


const DropdownList = (props) => { const DropdownList = (props) => {
const [listShown, setListShown] = useState(true);
const [listShown, setListShown] = useState(props.defaultOpen);
return ( return (
<ComponentContainer fullWidth={props.fullWidth}> <ComponentContainer fullWidth={props.fullWidth}>
<DropdownHeader> <DropdownHeader>
toggleIconClosed: PropTypes.node, toggleIconClosed: PropTypes.node,
children: PropTypes.node, children: PropTypes.node,
fullWidth: PropTypes.bool, fullWidth: PropTypes.bool,
defaultOpen: PropTypes.bool
}; };


DropdownList.defaultProps = { DropdownList.defaultProps = {
fullWidth: false, fullWidth: false,
defaultOpen: true
}; };

+ 2
- 2
src/components/Icon/Icon.styled.js Ver fichero

import { Icon } from "@mui/material";
import { Box, Icon } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";


export const ComponentContainer = styled.div`
export const ComponentContainer = styled(Box)`
` `


export const IconStyled = styled(Icon)` export const IconStyled = styled(Icon)`

+ 2
- 2
src/components/TextFields/TextField/TextField.styled.js Ver fichero

import { TextField } from "@mui/material";
import { Box, TextField } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";


const backgroundColor = `rgb(241, 241, 241)`; const backgroundColor = `rgb(241, 241, 241)`;


export const ComponentContainer = styled.div`
export const ComponentContainer = styled(Box)`
width: 100%; width: 100%;
padding-left: 0; padding-left: 0;
`; `;

+ 2
- 1
src/components/TextFields/TextFieldWithIcon/TextFieldWithIcon.styled.js Ver fichero

import { Box } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";
import { Icon } from "../../Icon/Icon"; import { Icon } from "../../Icon/Icon";
import { TextField } from "../TextField/TextField"; import { TextField } from "../TextField/TextField";


export const ComponentContainer = styled.div`
export const ComponentContainer = styled(Box)`
` `


export const TextFieldStyled = styled(TextField)` export const TextFieldStyled = styled(TextField)`

+ 35
- 23
src/pages/LoginPage/LoginPageMUI.js Ver fichero

Link, Link,
Typography, Typography,
} from "@mui/material"; } from "@mui/material";
import { LocationOn, LocationOnOutlined, Visibility, VisibilityOff } from "@mui/icons-material";
import {
LocationOn,
LocationOnOutlined,
Visibility,
VisibilityOff,
} from "@mui/icons-material";
import Backdrop from "../../components/MUI/BackdropComponent"; import Backdrop from "../../components/MUI/BackdropComponent";
import ErrorMessage from "../../components/MUI/ErrorMessageComponent"; import ErrorMessage from "../../components/MUI/ErrorMessageComponent";
import { selectIsLoadingByActionType } from "../../store/selectors/loadingSelectors"; import { selectIsLoadingByActionType } from "../../store/selectors/loadingSelectors";
fullWidth fullWidth
/> />
<TextField <TextField
name = "password"
placeholder = {t("common.labelPassword")}
margin = "normal"
type = {showPassword ? "text" : "password"}
value = {formik.values.password}
onChange = {formik.handleChange}
error = {formik.touched.password && Boolean(formik.errors.password)}
helperText = {formik.touched.password && formik.errors.password}
fullWidth = {true}
InputProps = {{
endAdornment: (
name="password"
placeholder={t("common.labelPassword")}
margin="normal"
type={showPassword ? "text" : "password"}
value={formik.values.password}
onChange={formik.handleChange}
error={formik.touched.password && Boolean(formik.errors.password)}
helperText={formik.touched.password && formik.errors.password}
fullWidth={true}
InputProps={{
endAdornment: (
<IconButton <IconButton
onClick={handleClickShowPassword} onClick={handleClickShowPassword}
onMouseDown={handleMouseDownPassword} onMouseDown={handleMouseDownPassword}
> >
{showPassword ? <Visibility /> : <VisibilityOff />} {showPassword ? <Visibility /> : <VisibilityOff />}
</IconButton> </IconButton>
),
}}
),
}}
/> />


<DropdownList title="Naslov" toggleIconOpened={<Visibility/>} toggleIconClosed={<Visibility/>} dropdownIcon={<LocationOnOutlined/>} fullWidth={true}>
{/* <DropdownList
title="Naslov"
toggleIconOpened={<Visibility />}
toggleIconClosed={<VisibilityOff />}
dropdownIcon={<LocationOnOutlined />}
fullWidth
defaultOpen={false}
>
<DropdownItem> <DropdownItem>
<CheckBox fullWidth leftText="Kategorija" rightText="124"/>
<CheckBox fullWidth leftText="Kategorija" rightText="124" />
</DropdownItem> </DropdownItem>
<DropdownItem> <DropdownItem>
<CheckBox fullWidth leftText="Kategorija" rightText="124"/>
<CheckBox fullWidth leftText="Kategorija" rightText="124" />
</DropdownItem> </DropdownItem>
<DropdownItem> <DropdownItem>
<CheckBox fullWidth leftText="Kategorija" rightText="124"/>
<CheckBox fullWidth leftText="Kategorija" rightText="124" />
</DropdownItem> </DropdownItem>
<DropdownItem> <DropdownItem>
<CheckBox fullWidth leftText="Kategorija" rightText="124"/>
<CheckBox fullWidth leftText="Kategorija" rightText="124" />
</DropdownItem> </DropdownItem>
<DropdownItem> <DropdownItem>
<CheckBox fullWidth leftText="Kategorija" rightText="124"/>
<CheckBox fullWidth leftText="Kategorija" rightText="124" />
</DropdownItem> </DropdownItem>
<DropdownItem> <DropdownItem>
<CheckBox fullWidth leftText="Kategorija" rightText="124"/>
<CheckBox fullWidth leftText="Kategorija" rightText="124" />
</DropdownItem> </DropdownItem>
<DropdownItem> <DropdownItem>
<CheckBox fullWidth leftText="Kategorija" rightText="124"/>
<CheckBox fullWidth leftText="Kategorija" rightText="124" />
</DropdownItem> </DropdownItem>
</DropdownList>
</DropdownList> */}


<PrimaryButtonWithIcon <PrimaryButtonWithIcon
icon={<Visibility />} icon={<Visibility />}

Cargando…
Cancelar
Guardar