-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #398 from MandeepPaul/fix/379-button-design-in-the…
…-home-page Fix/379 button design in the home page
- Loading branch information
Showing
11 changed files
with
195 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 21 additions & 35 deletions
56
...tend/src/scenes/dashboard/HomePageComponents/CreateActivityButton/ActivityButtonStyles.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,22 @@ | ||
|
||
// Define color constants | ||
const iconColor = '#667085'; | ||
const hoverColor = 'orange'; | ||
const textColor = '#344054'; | ||
const borderColor = '#FFD8C7'; | ||
const buttonBackgroundColor = '#FFFAFA'; | ||
|
||
export const activityButtonStyles = { | ||
|
||
button: { | ||
backgroundColor: buttonBackgroundColor, | ||
color: textColor, | ||
border: '1px solid ' + borderColor, | ||
fontSize: '16px', | ||
fontWeight: 400, | ||
lineHeight: '24px', | ||
textTransform: 'none', | ||
padding: '1.3rem 3rem', | ||
display: 'flex', | ||
alignItems: 'center', | ||
flexDirection: 'column', | ||
width: 'fit-content', | ||
boxShadow: 'none', | ||
borderRadius: '10px', | ||
gap: '1rem', | ||
width: '100%', | ||
':hover': { | ||
backgroundColor: hoverColor | ||
}, | ||
export const activityButtonStyles = { | ||
display: "flex", | ||
fontWeight: 400, | ||
backgroundColor: "var(--gray-50)", | ||
width: "100%", | ||
border: "1px solid var(--grey-border)", | ||
borderRadius: "10px", | ||
color: "var(--gray-400)", | ||
padding: "1.3rem 3rem", | ||
flexDirection: "column", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
transition: "box-shadow 0.3s ease", | ||
textTransform: "none", | ||
"&:hover": { | ||
border: "1px solid var(--gray-250)", | ||
backgroundColor: "var(--gray-100)", | ||
".childSkeleton": { | ||
border: "1px solid var(--blue-300)", | ||
}, | ||
icon: { | ||
color: iconColor, | ||
fontSize: '2rem' } | ||
}; | ||
|
||
}, | ||
}; |
34 changes: 13 additions & 21 deletions
34
...end/src/scenes/dashboard/HomePageComponents/CreateActivityButton/CreateActivityButton.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,25 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Button from '@mui/material/Button'; | ||
import WbIncandescentOutlinedIcon from '@mui/icons-material/WbIncandescentOutlined'; | ||
import DirectionsBusFilledOutlinedIcon from '@mui/icons-material/DirectionsBusFilledOutlined'; | ||
import { activityButtonStyles } from './ActivityButtonStyles'; | ||
|
||
const CreateActivityButton = ({ placeholder = '', onButtonClick = () => {} }) => { | ||
|
||
const icon = placeholder === 'Create a welcome tour' | ||
? <DirectionsBusFilledOutlinedIcon style={activityButtonStyles.icon} /> | ||
: <WbIncandescentOutlinedIcon style={activityButtonStyles.icon} />; | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import Button from "@mui/material/Button"; | ||
import { activityButtonStyles } from "./ActivityButtonStyles"; | ||
|
||
const CreateActivityButton = ({ | ||
placeholder = "", | ||
skeletonType, | ||
onClick = () => {}, | ||
}) => { | ||
return ( | ||
<Button | ||
variant="contained" | ||
startIcon={icon} | ||
onClick={onButtonClick} | ||
sx={{ | ||
...activityButtonStyles.button | ||
}} | ||
> | ||
<Button variant="text" onClick={onClick} sx={activityButtonStyles}> | ||
{skeletonType} | ||
{placeholder} | ||
</Button> | ||
); | ||
}; | ||
|
||
CreateActivityButton.propTypes = { | ||
skeletonType: PropTypes.node, | ||
placeholder: PropTypes.string, | ||
onButtonClick: PropTypes.func.isRequired, | ||
onClick: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default CreateActivityButton; |
23 changes: 9 additions & 14 deletions
23
...scenes/dashboard/HomePageComponents/CreateActivityButtonList/CreateActivityButtonList.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
import React from 'react'; | ||
import CreateActivityButton from '../CreateActivityButton/CreateActivityButton'; | ||
import styles from './CreateActivityButtonList.module.scss' | ||
import CreateActivityButton from "../CreateActivityButton/CreateActivityButton"; | ||
import styles from "./CreateActivityButtonList.module.scss"; | ||
|
||
const CreateActivityButtonList = ({ buttons }) => { | ||
return ( | ||
<div className={styles.activityButtons}> | ||
{buttons.map((button, index) => ( | ||
<CreateActivityButton | ||
key={index} | ||
placeholder={button.placeholder} | ||
onButtonClick={button.onClick} | ||
/> | ||
))} | ||
</div> | ||
); | ||
return ( | ||
<div className={styles.activityButtons}> | ||
{buttons.map((button, index) => ( | ||
<CreateActivityButton key={index} {...button} /> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default CreateActivityButtonList; |
49 changes: 49 additions & 0 deletions
49
frontend/src/scenes/dashboard/HomePageComponents/Skeletons/BannerSkeleton.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Skeleton } from "@mui/material"; | ||
import styles from "./Skeleton.module.scss"; | ||
|
||
const BannerSkeleton = () => { | ||
const skeletonStyles = { bgcolor: "var(--gray-200)", borderRadius: "3.12px" }; | ||
|
||
return ( | ||
<div className={styles.bannerSkeletonContainer}> | ||
<Skeleton | ||
variant="rounded" | ||
width={80} | ||
height={10} | ||
sx={{ bgcolor: "var(--gray-300", borderRadius: "3.12px" }} | ||
animation={false} | ||
/> | ||
<Skeleton | ||
variant="rectangular" | ||
width={210} | ||
height={28} | ||
sx={skeletonStyles} | ||
animation={false} | ||
/> | ||
<Skeleton | ||
variant="rectangular" | ||
width={210} | ||
height={20} | ||
sx={skeletonStyles} | ||
animation={false} | ||
/> | ||
|
||
<Skeleton | ||
className="childSkeleton" | ||
sx={{ | ||
position: "absolute", | ||
top: 20, | ||
left: "50%", | ||
transform: "translate(-50%, -50%)", | ||
bgcolor: "var(--blue-50)", | ||
}} | ||
variant="rounded" | ||
width={260} | ||
height={20} | ||
animation={false} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default BannerSkeleton; |
37 changes: 37 additions & 0 deletions
37
frontend/src/scenes/dashboard/HomePageComponents/Skeletons/BaseSkeleton.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Skeleton } from "@mui/material"; | ||
import styles from "./Skeleton.module.scss"; | ||
import { baseSkeletonStyles } from "./BaseSkeletonStyles"; | ||
|
||
const BaseSkeleton = ({ guideType, items = 4 }) => { | ||
const skeletonStyles = { bgcolor: "var(--gray-200)", borderRadius: "3.12px" }; | ||
const guideTypeStyles = baseSkeletonStyles[guideType] || {}; | ||
|
||
return ( | ||
<div className={styles.skeletonContainer}> | ||
{[...Array(items)].map((_, index) => ( | ||
<Skeleton | ||
key={index} | ||
variant="rounded" | ||
width={210} | ||
height={18} | ||
animation={false} | ||
sx={skeletonStyles} | ||
/> | ||
))} | ||
|
||
<Skeleton | ||
className="childSkeleton" | ||
variant="rounded" | ||
width={guideTypeStyles.width || 100} | ||
height={guideTypeStyles.height || 50} | ||
animation={false} | ||
sx={{ | ||
...guideTypeStyles, | ||
bgcolor: "var(--blue-50)", | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default BaseSkeleton; |
16 changes: 16 additions & 0 deletions
16
frontend/src/scenes/dashboard/HomePageComponents/Skeletons/BaseSkeletonStyles.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export const baseSkeletonStyles = { | ||
popup: { | ||
position: "absolute", | ||
top: 25, | ||
left: 30, | ||
width: 80, | ||
height: 35, | ||
}, | ||
helperLink: { | ||
position: "absolute", | ||
bottom: "1.3rem", | ||
right: "1rem", | ||
width: 75, | ||
height: 60, | ||
}, | ||
}; |
20 changes: 20 additions & 0 deletions
20
frontend/src/scenes/dashboard/HomePageComponents/Skeletons/Skeleton.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.skeletonContainer { | ||
position: relative; | ||
width: 256; | ||
height: 152; | ||
background-color: white; | ||
border-radius: 7.8px; | ||
border: 1.23px solid var(--grey-border); | ||
padding: 1.3rem 1rem; | ||
display: flex; | ||
justify-self: center; | ||
flex-direction: column; | ||
gap: 8px; | ||
width: auto; | ||
margin-bottom: 24px; | ||
} | ||
|
||
.bannerSkeletonContainer { | ||
@extend .skeletonContainer; | ||
padding-top: 40px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters