-
Notifications
You must be signed in to change notification settings - Fork 93
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
Add UI updates on Campaign cards and Inline Donation component #1500
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0d67981
update campaign cards spacings
1f6a0af
added hover effect on campaign card
229843f
Update progress bar
693acde
Remove styled.tsx file for Campaign progress bar
f174392
Updated money representation in inline donation component
bb50c18
Update card images height
d57e6ec
Update card images height
ef96cc8
Delete test image
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,57 +1,31 @@ | ||
import React, { useMemo } from 'react' | ||
|
||
import { styled } from '@mui/material/styles' | ||
import LinearProgress from '@mui/material/LinearProgress' | ||
import { Grid } from '@mui/material' | ||
|
||
import { UUID } from 'gql/types' | ||
|
||
const PREFIX = 'CampaignProgress' | ||
|
||
const classes = { | ||
root: `${PREFIX}-root`, | ||
bar: `${PREFIX}-bar`, | ||
donationProgress: `${PREFIX}-donationProgress`, | ||
cardActions: `${PREFIX}-cardActions`, | ||
} | ||
import ProgressBar from '@ramonak/react-progress-bar' | ||
|
||
const StyledGrid = styled(Grid)(({ theme }) => ({ | ||
[`&.${classes.donationProgress}`]: { | ||
width: '100%', | ||
'> div p': { | ||
color: theme.palette.text.secondary, | ||
padding: theme.spacing(1), | ||
}, | ||
}, | ||
|
||
[`& .${classes.cardActions}`]: { | ||
padding: '0', | ||
}, | ||
})) | ||
|
||
const BorderLinearProgress = LinearProgress | ||
import theme from 'common/theme' | ||
|
||
type Props = { | ||
campaignId: UUID | ||
raised: number | ||
target: number | ||
} | ||
|
||
export default function CampaignProgress({ campaignId, raised, target }: Props) { | ||
const percentage = useMemo(() => (raised / target) * 100, [raised, target]) | ||
|
||
return ( | ||
<StyledGrid className={classes.donationProgress} container> | ||
<Grid item xs={12}> | ||
<BorderLinearProgress | ||
variant="determinate" | ||
value={percentage > 100 ? 100 : percentage} | ||
aria-labelledby={`campaign-${campaignId}--donations-progressbar`} | ||
classes={{ | ||
root: classes.root, | ||
bar: classes.bar, | ||
}} | ||
/> | ||
</Grid> | ||
</StyledGrid> | ||
<ProgressBar | ||
completed={percentage > 100 ? 100 : percentage} | ||
aria-labelledby={`campaign-${campaignId}--donations-progressbar`} | ||
height={theme.spacing(1.62)} | ||
baseBgColor={'#b1defe'} | ||
bgColor={theme.palette.primary.main} | ||
labelColor={theme.palette.common.black} | ||
borderRadius={theme.borders.round} | ||
labelSize={theme.spacing(1.5)} | ||
labelAlignment="right" | ||
customLabelStyles={{ fontWeight: 400 }} | ||
/> | ||
) | ||
} |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a new progress bar package needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sashko9807
I was not able to achieve this effect:
with the Progress bar provided from MUI (https://mui.com/material-ui/react-progress/).
Probably there is a way to do it but it would overcomplicate the logic.
If you think we should avoid the library, please share alternative ideas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same question but, now that we have the answer - all good. Later we can remove it if we find a way to do it without separate library.