-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: refactor moderation auth pages (#903)
* feat(ui): create and export moderation error card - update interfaces * feat(apps): refactor moderation auth pages - remove redundant files
- Loading branch information
1 parent
e651a4f
commit 75bc116
Showing
9 changed files
with
127 additions
and
91 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
71 changes: 71 additions & 0 deletions
71
ui/design/src/components/Errors/moderation-app-error-card.tsx
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,71 @@ | ||
import React from 'react'; | ||
import { Box, Text, Image } from 'grommet'; | ||
|
||
import { Button } from '../Buttons'; | ||
|
||
import type { IModerationAppErrorCardProps } from './interfaces'; | ||
import { PageWrapper, ContentWrapper } from './styled-elements'; | ||
|
||
const ModerationAppErrorCard: React.FC<IModerationAppErrorCardProps> = props => { | ||
const { | ||
size, | ||
errorType, | ||
titleLabel, | ||
subtitleLabel, | ||
buttonLabel, | ||
textMarginTop, | ||
textMarginBottom, | ||
hasButton, | ||
imageBoxHasMargin, | ||
publicImgPath = '/images', | ||
showLoginModal, | ||
} = props; | ||
|
||
const handleClick = () => { | ||
if (showLoginModal) { | ||
showLoginModal(); | ||
} | ||
}; | ||
|
||
return ( | ||
<PageWrapper> | ||
<ContentWrapper pad={{ top: '0rem', horizontal: '5rem', bottom: '1.2rem' }}> | ||
<Box | ||
height={size} | ||
width={size} | ||
margin={{ ...(imageBoxHasMargin && { bottom: 'small' }) }} | ||
alignSelf="center" | ||
> | ||
<Image fit="contain" src={`${publicImgPath}/${errorType}.png`} /> | ||
</Box> | ||
<Text | ||
weight={600} | ||
margin={{ bottom: 'medium', horizontal: 'auto' }} | ||
size="xlarge" | ||
textAlign="center" | ||
> | ||
{titleLabel} | ||
</Text> | ||
<Text | ||
weight="normal" | ||
margin={{ | ||
...(textMarginTop && { top: 'xsmall' }), | ||
...(textMarginBottom && { bottom: 'medium' }), | ||
}} | ||
color="secondaryText" | ||
size="large" | ||
textAlign="center" | ||
> | ||
{subtitleLabel} | ||
</Text> | ||
{hasButton && ( | ||
<Box width="fit-content" alignSelf="center"> | ||
<Button primary={true} label={buttonLabel} onClick={handleClick} /> | ||
</Box> | ||
)} | ||
</ContentWrapper> | ||
</PageWrapper> | ||
); | ||
}; | ||
|
||
export default ModerationAppErrorCard; |
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