This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
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 #67 from gnosis/development
safe-react-components v0.3.0
- Loading branch information
Showing
167 changed files
with
2,228 additions
and
1,048 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"extends": [ | ||
"react-app", | ||
"prettier", | ||
"prettier/react", | ||
"plugin:import/errors", | ||
"plugin:@typescript-eslint/recommended" | ||
"plugin:react/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier/@typescript-eslint", | ||
"plugin:prettier/recommended" | ||
], | ||
"plugins": ["prettier", "import"] | ||
"plugins": ["react-hooks"], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"rules": { | ||
"react-hooks/rules-of-hooks": "error", | ||
"react-hooks/exhaustive-deps": "warn", | ||
"react/prop-types": "off" | ||
} | ||
} |
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,9 @@ | ||
name: 'my-workflow' | ||
on: [pull_request] | ||
|
||
jobs: | ||
eslint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: bradennapier/eslint-plus-action@v3.4.0 |
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ yalc.lock | |
/storybook-static | ||
|
||
# misc | ||
/.idea | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
|
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,65 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { parseToHsl } from 'polished'; | ||
|
||
import { Text, theme } from './index'; | ||
|
||
const Grid = styled.div` | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: space-evenly; | ||
`; | ||
|
||
const ColorWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
margin: 16px; | ||
`; | ||
|
||
const ColorDisplay = styled.div<{ color: string }>` | ||
margin: 8px auto; | ||
width: 100px; | ||
height: 100px; | ||
border: 1px solid #000000; | ||
background-color: ${({ color }) => color}; | ||
`; | ||
|
||
export default { | ||
title: 'Colors', | ||
}; | ||
|
||
export const ColorsSample = (): React.ReactElement => { | ||
const colors = Object.keys(theme.colors) | ||
.reduce((acc: { name: string; code: string }[], name: string) => { | ||
if (typeof (theme.colors as Record<string, unknown>)[name] === 'string') { | ||
acc.push({ | ||
name, | ||
code: ((theme.colors as Record<string, unknown>)[ | ||
name | ||
] as string).toUpperCase(), | ||
}); | ||
} | ||
return acc; | ||
}, []) | ||
.sort( | ||
({ code: colorA }, { code: colorB }) => | ||
parseToHsl(colorA).lightness - parseToHsl(colorB).lightness | ||
); | ||
|
||
return ( | ||
<Grid> | ||
{colors?.map(({ name, code }) => ( | ||
<ColorWrapper key={name}> | ||
<ColorDisplay color={code} /> | ||
<Text size="md" center> | ||
{name} | ||
</Text> | ||
<Text size="md" center> | ||
{code} | ||
</Text> | ||
</ColorWrapper> | ||
))} | ||
</Grid> | ||
); | ||
}; |
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,9 +1,28 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const Divider = styled.div` | ||
type Props = { | ||
className?: string; | ||
orientation?: 'vertical' | 'horizontal'; | ||
}; | ||
|
||
const HorizontalDivider = styled.div` | ||
border-top: 2px solid ${({ theme }) => theme.colors.separator}; | ||
margin: 16px 0; | ||
`; | ||
|
||
export default ({ ...args }) => <Divider {...args} />; | ||
const VerticalDivider = styled.div` | ||
border-right: 2px solid ${({ theme }) => theme.colors.separator}; | ||
margin: 0 5px; | ||
height: 100%; | ||
`; | ||
|
||
const Divider = ({ className, orientation }: Props): React.ReactElement => { | ||
return orientation === 'vertical' ? ( | ||
<VerticalDivider className={className} /> | ||
) : ( | ||
<HorizontalDivider className={className} /> | ||
); | ||
}; | ||
|
||
export default Divider; |
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.