Skip to content

Commit

Permalink
Standardize CTA buttons per our design docs
Browse files Browse the repository at this point in the history
  • Loading branch information
esteban-gs committed Sep 16, 2023
1 parent d1c68cd commit 8565dfa
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 46 deletions.
63 changes: 63 additions & 0 deletions client/src/components/Buttons/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { makeStyles } from 'tss-react/mui';
import { Button, Typography } from '@mui/material';
import theme from '../../theme';
import { ReactNode } from 'react';

const useStyles = makeStyles()(() => ({
CTAHeroButton: {
color: 'white',
backgroundColor: theme.palette.primary.main,
borderRadius: '10px',
fontWeight: 'semi-bold',
border: 'none',
'&:hover': {
backgroundColor: theme.palette.primary.main,
cursor: 'pointer',
},
},
primaryCTAButton: {
textTransform: 'capitalize',
backgroundColor: theme.palette.primary.main,
color: `${theme.palette.primary.contrastText}`,
borderRadius: '10px',
border: `1px solid ${theme.palette.primary.main}`,
marginLeft: '0px',
width: '100px',
'&:hover': {
color: `${theme.palette.text.primary}`,
},
},
}));

type Props = {
text: string;
onClick?: () => void;
children?: ReactNode;
};

export function CTAHeroButton({ text, onClick }: Props) {
const { classes } = useStyles();

return (
<button onClick={onClick} className={classes.CTAHeroButton}>
<Typography
sx={{
fontSize: '22px',
padding: '15px 25px 15px 25px',
}}
>
{text}
</Typography>
</button>
);
}

export function PrimaryCTAButton({ text, onClick, children }: Props) {
const { classes } = useStyles();
return (
<Button component="span" onClick={onClick} className={classes.primaryCTAButton}>
{text}
{children}
</Button>
);
}
43 changes: 0 additions & 43 deletions client/src/components/Buttons/CTAButton.tsx

This file was deleted.

15 changes: 12 additions & 3 deletions client/src/components/Forms/FileUploadInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { makeStyles } from 'tss-react/mui';
import { FormControl, FormLabel, Button } from '@mui/material';

import type { Theme } from '@mui/material/styles';
import { CTAHeroButton, PrimaryCTAButton } from '../Buttons/Button';

const useStyles = makeStyles()((theme: Theme) => ({
buttonText: {
Expand All @@ -20,6 +21,7 @@ type CustomProps = {
id: string;
label: string;
text: string;
buttonVariant?: 'CTAHeroButton' | 'primaryCTAButton';
onChange: (event: any) => void;
};

Expand All @@ -36,11 +38,18 @@ function FileUploadInput(props: CustomProps) {
id="raised-button-file"
multiple
type="file"
onChange={props.onChange}
/>
<label htmlFor="raised-button-file">
<Button component="span" className={classes.buttonText}>
{props.text}
</Button>
{props.buttonVariant === 'primaryCTAButton' ? (
<PrimaryCTAButton text={props.text}></PrimaryCTAButton>
) : props.buttonVariant === 'CTAHeroButton' ? (
<CTAHeroButton text={props.text}></CTAHeroButton>
) : (
<Button component="span" className={classes.buttonText}>
{props.text}
</Button>
)}
</label>
</FormControl>
);
Expand Down

0 comments on commit 8565dfa

Please sign in to comment.