Skip to content

Commit 41dbe41

Browse files
authored
Merge pull request #1008 from julisod/pre-STAG-node-22
Make banner a single static image and update styles
2 parents 2f53ff3 + a45b641 commit 41dbe41

4 files changed

Lines changed: 23 additions & 131 deletions

File tree

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

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,37 @@
1-
import { Box } from '@mui/material'
2-
import EventImage from 'components/generic/EventImage'
31
import React, { useState, useEffect } from 'react'
4-
import { SwipeableViews } from 'components/animated/SwipeableViews'
2+
3+
import { Box } from '@mui/material'
4+
import { styled } from '@mui/material/styles'
5+
6+
import Image from 'components/generic/Image'
57
import BannerService from 'services/banner'
68

7-
const BannerCarousel = (event = null) => {
9+
const Banner = styled(Box)({
10+
maxHeight: '465px',
11+
display: 'flex',
12+
alignItems: 'center',
13+
overflow: 'hidden',
14+
})
15+
16+
// This used to have SwipeableViews, that's why it's called a carousel
17+
const BannerCarousel = () => {
818
const [pictures, setPictures] = useState([])
9-
const [index, setIndex] = useState(0)
1019

1120
useEffect(() => {
1221
BannerService.getAllBanners().then(banners => {
1322
if (banners) setPictures(banners)
1423
})
1524
}, [])
1625
return (
17-
<>
18-
<Box className="relative mt-0">
19-
<SwipeableViews
20-
enableMouseEvents
21-
index={index}
22-
onChangeIndex={setIndex}
23-
interval={5000}
24-
disabled
25-
>
26-
{pictures?.map(picture => (
27-
<Box
28-
key={picture._id}
29-
className="bg-black flex flex-col items-center justify-center h-full max-h-[465px]"
30-
>
31-
<EventImage
32-
className="w-full h-full max-h-[465px] object-contain max-w-[1440px]"
33-
publicId={picture.icon}
34-
defaultImage={require('assets/images/default_cover_image.png')}
35-
transformation={{
36-
width: 1440,
37-
height: 465,
38-
}}
39-
buttons={picture.buttons}
40-
/>
41-
</Box>
42-
))}
43-
</SwipeableViews>
44-
</Box>
45-
</>
26+
<Banner>
27+
{pictures?.map(picture => (
28+
<Image
29+
publicId={picture.icon}
30+
defaultImage={require('assets/images/default_cover_image.png')}
31+
key={picture._id}
32+
/>
33+
))}
34+
</Banner>
4635
)
4736
}
4837

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,6 @@ const getButton = (color, variant, strong) => {
9999
},
100100
}
101101
}
102-
case 'containedEventImage': {
103-
return {
104-
backgroundColor: colorPalette.main,
105-
color: colorPalette.contrastText,
106-
border: `2px solid ${colorPalette.main}`,
107-
height: '2.6em',
108-
borderRadius: '28px',
109-
fontSize: '1.3em',
110-
margin: theme.spacing(2),
111-
'&:hover': {
112-
backgroundColor: colorPalette.main,
113-
},
114-
}
115-
}
116102
case 'outlined': {
117103
return {
118104
backgroundColor: 'white',

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

Lines changed: 0 additions & 76 deletions
This file was deleted.

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ const variantStyles = (variant, color) => {
5454
'disabled:bg-current disabled:text-white disabled:opacity-50': true,
5555
[`disabled:bg-${color}-700`]: true,
5656
}
57-
case 'containedEventImage':
58-
return {
59-
'bg-current text-white border-2 border-current h-10 rounded-full text-lg mt-2': true,
60-
[`bg-${color}-600 border-${color}-600 hover:bg-${color}-700`]: true,
61-
'disabled:bg-current disabled:text-white disabled:opacity-50': true,
62-
[`disabled:bg-${color}-700`]: true,
63-
}
6457
case 'jOutlined':
6558
return {
6659
'bg-transparent text-current border-2 rounded-full px-4 py-1': true,

0 commit comments

Comments
 (0)