Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radiobutton component #90

Merged
merged 26 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
df9c52b
Check Icons done
KenanTopal Jun 2, 2024
adf11bb
Merge branch 'develop' of https://github.com/bluewave-labs/bluewave-o…
KenanTopal Jun 4, 2024
bf18fc1
created RadioButton component
KenanTopal Jun 13, 2024
84c415f
Merge remote-tracking branch 'origin/develop' into radiobutton-component
KenanTopal Jul 1, 2024
0aa1edb
radio button component implementation
KenanTopal Jul 1, 2024
9690044
Update Dashboard.jsx
KenanTopal Jul 12, 2024
5df763a
Merge remote-tracking branch 'origin/develop' into radiobutton-component
KenanTopal Jul 12, 2024
d30ee24
implemented requested changes
KenanTopal Jul 12, 2024
0de4067
Merge branch 'develop' into radiobutton-component
uparkalau Jul 27, 2024
0821ce7
Merge branch 'develop' into radiobutton-component
uparkalau Aug 8, 2024
1032be4
RadioButton: update code
SimerdeepSinghGrewal Aug 14, 2024
e07f3a6
Merge branch 'radiobutton-component' of https://github.com/bluewave-l…
SimerdeepSinghGrewal Aug 14, 2024
e6093e4
Delete frontend/src/Styles.js
erenfn Aug 20, 2024
05cc825
Update App.jsx
erenfn Aug 20, 2024
76d3cd3
RadioButton: update functionality, moved style to css
SimerdeepSinghGrewal Aug 26, 2024
7df9c1e
Merge branch 'radiobutton-component' of https://github.com/bluewave-l…
SimerdeepSinghGrewal Aug 26, 2024
0a1c64d
Merge branch 'develop' of https://github.com/bluewave-labs/bluewave-o…
SimerdeepSinghGrewal Aug 26, 2024
a0ad71e
merge develop
erenfn Aug 26, 2024
49a2600
Tried buttons on banner left content
erenfn Aug 26, 2024
b466ee1
Merge branch 'radiobutton-component' of https://github.com/bluewave-l…
erenfn Aug 26, 2024
5fac4fe
Merge branch 'develop' of https://github.com/bluewave-labs/bluewave-o…
SimerdeepSinghGrewal Aug 27, 2024
ed92ba0
Merge branch 'radiobutton-component' of https://github.com/bluewave-l…
SimerdeepSinghGrewal Aug 27, 2024
1fc0504
RadioButton: update bannerLeftContent for functionality and update st…
SimerdeepSinghGrewal Aug 27, 2024
1cb5095
radiobutton fixes
erenfn Aug 28, 2024
f88699e
Update package.json
erenfn Aug 28, 2024
e895205
npm install
erenfn Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SetNewPasswordPage from "./scenes/login/SetNewPassword";




function App() {
// const isAuthenticated = useSelector((state) => state.auth.isLoggedIn); // TODO: redux implementation
const isAuthenticated = true;// emulate login
Expand Down
29 changes: 29 additions & 0 deletions frontend/src/Styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const colors = {
purple: '#7F56D9',
darkGrey: '#344054',
grey: '#5D6B98',
lightGrey: '#B9C0D4',
green: '#079455'
};

export const fonts = {
fontFamily: "Inter, sans-serif",
bold: {
size: '16px',
lineHeight: '24px',
color: colors.darkGrey,
fontWeight: 500
},
default: {
size: '13px',
lineHeight: '13px',
color: colors.darkGrey,
fontWeight: 400
},
informative: {
size: '11px',
lineHeight: '11px',
color: colors.darkGrey,
fontWeight: 400
}
};
33 changes: 33 additions & 0 deletions frontend/src/components/CheckIcon/CheckIcon.jsx
KenanTopal marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ThemeProvider, createTheme } from "@mui/material";
import { PropTypes } from "@mui/material";
erenfn marked this conversation as resolved.
Show resolved Hide resolved
import { colors } from "../../Styles";
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';

export default function CheckIcon({ size, type, color }) {
const theme = createTheme({
palette: {
purple: colors.purple,
black: colors.black,
green: colors.green
}
});

const iconSize = size === "small" ? 20 : size === "medium" ? 24 : 28;

const checkIconStyle = {
width: iconSize,
height: iconSize,
color: color === "purple" || color === "black" ? color : "green",
...style
erenfn marked this conversation as resolved.
Show resolved Hide resolved
};

return (
<ThemeProvider theme={theme}>
{(type == 'outline') ?
<CheckCircleOutlineIcon sx={checkIconStyle} /> :
<CheckCircleIcon sx={checkIconStyle} />
}
</ThemeProvider>
)
}
52 changes: 52 additions & 0 deletions frontend/src/components/CheckIcon/CheckIcon.stories.js
KenanTopal marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const commonOutlinedProps = {
type: 'outline',
size: 'medium'
};

const commonSolidProps = {
type: 'solid',
size: 'medium'
}


export const PurpleOutline = {
args: {
...commonOutlinedProps,
color: 'purple'
}
};

export const BlackOutline = {
args: {
...commonOutlinedProps,
color: 'black'
}
};

export const GreenOutline = {
args: {
...commonOutlinedProps,
color: 'green'
}
};

export const PurpleSolid = {
args: {
...commonSolidProps,
color: 'purple'
}
};

export const BlackSolid = {
args: {
...commonSolidProps,
color: 'black'
}
};

export const GreenSolid = {
args: {
...commonSolidProps,
color: 'green'
}
};
44 changes: 44 additions & 0 deletions frontend/src/components/RadioButton/RadioButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from "react";
import './RadioButtonStyles.css';
import PropTypes from "prop-types";
import { Radio } from "@mui/material";

const RadioButton = ({
uparkalau marked this conversation as resolved.
Show resolved Hide resolved
id,
name,
value,
label,
onChange,
buttonSize = 'small',
color = 'default',
enabled = true,
}) => {
const main_purple = 'var(--main-purple)';
const sizeClass = buttonSize ==='large' ? 'radio-large' : 'radio-small';
return (
<div className={`radio-button ${sizeClass}`}>
<Radio
id={id}
name = {name}
value={value}
disabled={!enabled}
onChange={onChange}
size={buttonSize === 'large' ? 'large' : 'small'}
style={{ color: color === 'default' ? main_purple : color }}
/>
{ label && <label htmlFor={id}>{label}</label> }
</div >
);
};

RadioButton.propTypes = {
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
enabled: PropTypes.bool,
onchange: PropTypes.func,
color: PropTypes.string,
};

export default RadioButton;
20 changes: 20 additions & 0 deletions frontend/src/components/RadioButton/RadioButtonStyles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
input{
accent-color: #7F56D9;
}

input:active{
accent-color: #7F56D9;
outline: 5px solid #9E77ED3D;
border-radius: 5px;
}
.radio-small {
width: 16px;
height: 16px;
border-radius: 4px;
}

.radio-large {
width: 20px;
height: 20px;
border-radius: 6px;
}