-
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.
DEV-489: Refactor contributor dashboard to use react-query,
hide deleted contribs locally
- Loading branch information
1 parent
2320097
commit 60be657
Showing
59 changed files
with
1,964 additions
and
413 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,3 @@ | ||
<!-- needed for elements/modal/Modal --> | ||
|
||
<div id="modal-root"></div> |
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,14 @@ | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import Pagination from './Pagination'; | ||
export default { | ||
argTypes: { | ||
count: { control: 'number', defaultValue: 5 }, | ||
page: { control: 'number', defaultValue: 2 } | ||
}, | ||
component: Pagination, | ||
title: 'Base/Pagination' | ||
} as ComponentMeta<typeof Pagination>; | ||
|
||
const Template: ComponentStory<typeof Pagination> = (props) => <Pagination {...props} />; | ||
|
||
export const Default = Template.bind({}); |
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 { axe } from 'jest-axe'; | ||
import { render, screen } from 'test-utils'; | ||
import Pagination, { PaginationProps } from './Pagination'; | ||
|
||
function tree(props?: PaginationProps) { | ||
return render(<Pagination count={2} page={1} {...props} />); | ||
} | ||
|
||
describe('Pagination', () => { | ||
it('renders a navigation', () => { | ||
tree(); | ||
expect(screen.getByRole('navigation')).toBeVisible(); | ||
}); | ||
|
||
it('is accessible', async () => { | ||
const { container } = tree(); | ||
|
||
expect(await axe(container)).toHaveNoViolations(); | ||
}); | ||
}); |
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,19 @@ | ||
import { Pagination as MuiPagination, PaginationProps as MuiPaginationProps } from '@material-ui/lab'; | ||
import styled from 'styled-components'; | ||
|
||
export const Pagination = styled(MuiPagination)` | ||
&& { | ||
align-items: center; | ||
display: flex; | ||
justify-content: center; | ||
button.Mui-selected { | ||
background-color: #6fd1ec; | ||
border-radius: 4px; | ||
font-weight: 700; | ||
} | ||
} | ||
`; | ||
|
||
export type PaginationProps = MuiPaginationProps; | ||
export default Pagination; |
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,41 @@ | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import Table from './Table'; | ||
import TableBody from './TableBody'; | ||
import TableCell from './TableCell'; | ||
import TableHead from './TableHead'; | ||
import TableRow from './TableRow'; | ||
export default { | ||
component: Table, | ||
title: 'Base/Table' | ||
} as ComponentMeta<typeof Table>; | ||
|
||
const Template: ComponentStory<typeof Table> = (props) => ( | ||
<Table {...props}> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>ID</TableCell> | ||
<TableCell>Color</TableCell> | ||
<TableCell>Cost</TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
<TableRow> | ||
<TableCell>1</TableCell> | ||
<TableCell>Red</TableCell> | ||
<TableCell>$1.99</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>2</TableCell> | ||
<TableCell>Green</TableCell> | ||
<TableCell>$4.99</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>3</TableCell> | ||
<TableCell>Blue</TableCell> | ||
<TableCell>$0.99</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
</Table> | ||
); | ||
|
||
export const Unsortable = Template.bind({}); |
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,66 @@ | ||
import { axe } from 'jest-axe'; | ||
import { render, screen } from 'test-utils'; | ||
import Table from './Table'; | ||
import TableBody from './TableBody'; | ||
import TableCell from './TableCell'; | ||
import TableHead from './TableHead'; | ||
import TableRow from './TableRow'; | ||
|
||
// This tests all components in this directory since they should be used | ||
// together. | ||
|
||
function tree() { | ||
return render( | ||
<Table> | ||
<TableHead> | ||
<TableRow> | ||
<TableCell>ID</TableCell> | ||
<TableCell>Color</TableCell> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
<TableRow> | ||
<TableCell>1</TableCell> | ||
<TableCell>Red</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>2</TableCell> | ||
<TableCell>Green</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>3</TableCell> | ||
<TableCell>Blue</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
</Table> | ||
); | ||
} | ||
|
||
describe('Table', () => { | ||
it('renders a table', () => { | ||
tree(); | ||
expect(screen.getByRole('table')).toBeVisible(); | ||
}); | ||
|
||
it('renders headers', () => { | ||
tree(); | ||
expect(screen.getByRole('columnheader', { name: 'ID' })).toBeVisible(); | ||
expect(screen.getByRole('columnheader', { name: 'Color' })).toBeVisible(); | ||
}); | ||
|
||
it('renders cells', () => { | ||
tree(); | ||
expect(screen.getByRole('cell', { name: '1' })).toBeVisible(); | ||
expect(screen.getByRole('cell', { name: '2' })).toBeVisible(); | ||
expect(screen.getByRole('cell', { name: '3' })).toBeVisible(); | ||
expect(screen.getByRole('cell', { name: 'Red' })).toBeVisible(); | ||
expect(screen.getByRole('cell', { name: 'Green' })).toBeVisible(); | ||
expect(screen.getByRole('cell', { name: 'Blue' })).toBeVisible(); | ||
}); | ||
|
||
it('is accessible', async () => { | ||
const { container } = tree(); | ||
|
||
expect(await axe(container)).toHaveNoViolations(); | ||
}); | ||
}); |
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 { Table as MuiTable, TableProps as MuiTableProps } from '@material-ui/core'; | ||
|
||
export const Table = MuiTable; | ||
export type TableProps = MuiTableProps; | ||
export default Table; |
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 { TableBody as MuiTableBody, TableBodyProps as MuiTableBodyProps } from '@material-ui/core'; | ||
|
||
export const TableBody = MuiTableBody; | ||
export type TableBodyProps = MuiTableBodyProps; | ||
export default TableBody; |
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,12 @@ | ||
import { TableCell as MuiTableCell, TableCellProps as MuiTableCellProps } from '@material-ui/core'; | ||
import styled from 'styled-components'; | ||
|
||
export const TableCell = styled(MuiTableCell)` | ||
&& { | ||
border: none; | ||
font: 16px Roboto, sans-serif; | ||
} | ||
`; | ||
|
||
export type TableCellProps = MuiTableCellProps; | ||
export default TableCell; |
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 { TableContainer as MuiTableContainer, TableContainerProps as MuiTableContainerProps } from '@material-ui/core'; | ||
|
||
export const TableContainer = MuiTableContainer; | ||
export type TableContainerProps = MuiTableContainerProps; | ||
export default TableContainer; |
Oops, something went wrong.