generated from gabrielduete/frontend-template-nextjs
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #49 from gabrielduete/feat/add-cases-loading-and-e…
…rror feat: add cases loading and error
- Loading branch information
Showing
14 changed files
with
171 additions
and
49 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
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,13 @@ | ||
import { render, screen } from '@testing-library/react' | ||
|
||
import ErrorCase from '.' | ||
|
||
describe('<ErrorCase />', () => { | ||
it('should render the ErrorCase component', () => { | ||
render(<ErrorCase onClick={jest.fn()} />) | ||
|
||
expect( | ||
screen.getByText('Something went wrong. Please try again.') | ||
).toBeInTheDocument() | ||
}) | ||
}) |
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 @@ | ||
import ErrorIcon from '@mui/icons-material/Error' | ||
|
||
import * as S from './styles' | ||
|
||
type ErrorCaseProps = { | ||
hasMargin?: boolean | ||
onClick: () => void | ||
} | ||
|
||
const ErrorCase = ({ hasMargin, onClick }: ErrorCaseProps) => { | ||
return ( | ||
<S.Container hasMargin={hasMargin}> | ||
<ErrorIcon fontSize='large' /> | ||
<S.Text>Something went wrong. Please try again.</S.Text> | ||
<S.RetryButton onClick={onClick}>Retry</S.RetryButton> | ||
</S.Container> | ||
) | ||
} | ||
|
||
export default ErrorCase |
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,28 @@ | ||
import styled from 'styled-components' | ||
|
||
export const Container = styled.div<{ hasMargin?: boolean }>` | ||
display: flex; | ||
gap: var(--spacing-basic); | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
margin-top: ${({ hasMargin }) => hasMargin && '50%'}; | ||
` | ||
|
||
export const Text = styled.p` | ||
font-size: var(--font-xmedium); | ||
text-align: center; | ||
` | ||
|
||
export const RetryButton = styled.button` | ||
cursor: pointer; | ||
color: var(--green-white); | ||
background: none; | ||
border: none; | ||
font-size: var(--font-xsmall); | ||
transition: 0.5s ease; | ||
&:hover { | ||
color: var(--white); | ||
} | ||
` |
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,15 @@ | ||
import { Skeleton } from '@mui/material' | ||
|
||
const SkeletonText = () => { | ||
const skeletons = [160, 120, 70, 50] | ||
|
||
return ( | ||
<> | ||
{skeletons.map((height, index) => ( | ||
<Skeleton key={index} height={height} animation='wave' /> | ||
))} | ||
</> | ||
) | ||
} | ||
|
||
export default SkeletonText |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Block } from '~/src/helpers/notionConverter/notionConverter.types' | ||
|
||
export type NavBarProps = { | ||
pages: Block[] | ||
} |
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