Skip to content

Commit be72e31

Browse files
committed
Update pricing page and container to MUI v6
Also made everything centered (buttons were crooked), added rounded edges to the back button when hovered and made the long email wrap instead of flowing over the container.
1 parent 2c20c7a commit be72e31

3 files changed

Lines changed: 55 additions & 75 deletions

File tree

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
import React from 'react'
2-
import clsx from 'clsx'
2+
import { Box } from '@mui/material'
3+
import { styled } from '@mui/material/styles'
34

4-
const Container = ({
5-
wrapperClass = null,
6-
className = null,
7-
small = false,
8-
center = false,
9-
children,
10-
}) => {
11-
return (
12-
<div className={clsx('px-8', wrapperClass)}>
13-
<div
14-
className={clsx(
15-
'mx-auto w-full max-w-[1120px]',
16-
small && 'w-3/5 md:w-4/5',
17-
center && 'text-center',
18-
className,
19-
)}
20-
>
21-
{children}
22-
</div>
23-
</div>
24-
)
5+
const Wrapper = styled(Box, {
6+
// This specifies which props should not get passed down to the DOM,
7+
// will throw a console error if you do.
8+
shouldForwardProp: prop => prop !== 'center' && prop !== 'small',
9+
})(({ theme, center, small }) => ({
10+
padding: theme.spacing(0, 2),
11+
margin: '0 auto',
12+
maxWidth: '1120px',
13+
14+
textAlign: center && 'center',
15+
width: small ? '60%' : '100%',
16+
[theme.breakpoints.down('md')]: {
17+
width: small && '80%',
18+
},
19+
}))
20+
21+
const Container = ({ children, ...props }) => {
22+
return <Wrapper {...props}>{children}</Wrapper>
2523
}
2624

2725
export default Container

frontend/src/components/generic/PricingCard/index.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'react'
2-
import { Box, Typography, Grid } from '@mui/material'
2+
import { Box, Typography, Grid2 as Grid } from '@mui/material'
33
import CheckIcon from '@mui/icons-material/Check'
44
import List from '@mui/material/List'
55
import ListItem from '@mui/material/ListItem'
6+
import { styled } from '@mui/material/styles'
67

78
const PricingItem = ({ topic, price }) => {
89
//TODO add plain text to locale to enable translation
@@ -17,34 +18,33 @@ const PricingItem = ({ topic, price }) => {
1718

1819
const renderText = arr => {
1920
return arr.map((text, index) => (
20-
<ListItem key={index} className="flex items-center">
21-
<CheckIcon className="mr-2" />
21+
<ListItem key={index}>
22+
<CheckIcon sx={{ mr: '0.5rem' }} />
2223
<Typography>{text}</Typography>
2324
</ListItem>
2425
))
2526
}
2627

28+
const CardWrapper = styled(Box)({
29+
background: '#fbfbfb',
30+
borderWidth: '2px',
31+
borderRadius: '16px',
32+
borderColor: '#232323',
33+
'&:hover': {
34+
borderColor: '#73F9EC',
35+
},
36+
padding: '1rem',
37+
})
38+
2739
return (
28-
<Grid item xs={12} md={4} lg={4}>
29-
<Box
30-
border={2}
31-
className="bg-gray-50 rounded-lg border-gray-900 hover:border-teal-400"
32-
>
33-
<Box className="relative p-4 h-88">
34-
<Typography variant="h6" className="text-pink-500">
35-
{topic}
36-
</Typography>
37-
<List>{renderText(body)}</List>
38-
<Box mt={1} />
39-
</Box>
40-
<Box className="p-4">
41-
<Box className="flex flex-row flex-wrap">
42-
<Typography variant="h6" className="font-bold">
43-
{price}
44-
</Typography>
45-
</Box>
46-
</Box>
47-
</Box>
40+
<Grid size={{ xs: 12, md: 4 }}>
41+
<CardWrapper>
42+
<Typography variant="h6">{topic}</Typography>
43+
<List>{renderText(body)}</List>
44+
<Typography variant="h6" sx={{ wordBreak: 'break-word' }}>
45+
{price}
46+
</Typography>
47+
</CardWrapper>
4848
</Grid>
4949
)
5050
}

frontend/src/pages/_pricing/index.js

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
11
import React from 'react'
22

3-
import { Grid, Typography } from '@mui/material'
4-
53
import Footer from 'components/layouts/Footer'
64
import PageWrapper from 'components/layouts/PageWrapper'
75

8-
import Divider from 'components/generic/Divider'
96
import Button from 'components/generic/Button'
107

118
import Container from 'components/generic/Container'
129
import GlobalNavBar from 'components/navbars/GlobalNavBar'
1310
import PricingCard from 'components/generic/PricingCard'
11+
12+
import { Grid2 as Grid, Typography } from '@mui/material'
1413
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos'
1514

1615
import { useTranslation } from 'react-i18next'
1716
import { useNavigate } from 'react-router-dom'
1817

19-
// const useStyles = styled(theme => ({
20-
// backButtonWrapper: {
21-
// position: 'absolute',
22-
// zIndex: 10,
23-
// width: '100%',
24-
// paddingTop: theme.spacing(1),
25-
// },
26-
27-
// pricingWrapper: {
28-
// width: '100%',
29-
// paddingTop: '2em',
30-
// },
31-
// }))
32-
3318
export default () => {
3419
const navigate = useNavigate()
3520
const { t } = useTranslation()
@@ -40,11 +25,13 @@ export default () => {
4025
footer={() => <Footer />}
4126
render={() => (
4227
<>
43-
<Container
44-
center
45-
wrapperClass={'classes.backButtonWrapper'}
46-
>
47-
<Button onClick={() => navigate('/')}>
28+
<Container center sx={{ pt: 1 }}>
29+
<Button
30+
sx={{
31+
borderRadius: '10px',
32+
}}
33+
onClick={() => navigate('/')}
34+
>
4835
<ArrowBackIosIcon style={{ color: 'black' }} />
4936
<Typography
5037
variant="button"
@@ -54,38 +41,33 @@ export default () => {
5441
</Typography>
5542
</Button>
5643
</Container>
57-
<Divider size={3} />
58-
<Container center wrapperClass={'classes.pricingWrapper'}>
44+
<Container center sx={{ pt: '0.5em', pb: '1.5em' }}>
5945
<Grid
6046
container
6147
direction="row"
6248
justifyContent="center"
63-
spacing={3}
49+
spacing={2}
6450
>
6551
<PricingCard
6652
topic="What we offer"
6753
price="Ask: hello@hackjunction.com"
6854
/>
69-
<Divider size={4} />
70-
<Typography variant="body1" justifyContent="center">
55+
<Typography variant="body1">
7156
Our expertise of organising hackathons combined
7257
with the power of a highly-customizable platform
7358
for events makes hosting diverse events
7459
possible.
7560
</Typography>
76-
<Divider size={4} />
7761
<Button
7862
variant="outlined"
7963
color="theme_lightgray"
8064
strong
81-
m={6}
8265
onClick={() => navigate('/contact')}
8366
>
8467
{t('Contact_us_')}
8568
</Button>
8669
</Grid>
8770
</Container>
88-
<Divider size={4} />
8971
</>
9072
)}
9173
/>

0 commit comments

Comments
 (0)