Skip to content

Commit

Permalink
add Modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Barry127 committed Nov 23, 2020
1 parent 1102202 commit 00795eb
Show file tree
Hide file tree
Showing 16 changed files with 1,129 additions and 4 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"focusring",
"lcov",
"maeven",
"maximizable",
"mixins",
"monokai",
"octicons",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"react-dom": "^16.13.1",
"react-live": "^2.2.2",
"react-test-renderer": "^16.14.0",
"resize-observer-polyfill": "^1.5.1",
"rimraf": "^3.0.2",
"rollup": "^2.32.0",
"rollup-plugin-postcss-modules": "^2.0.2",
Expand Down Expand Up @@ -143,7 +144,7 @@
}
},
"transformIgnorePatterns": [
"/node_modules/react-spring/"
"node_modules/react-spring"
],
"setupFilesAfterEnv": [
"./src/setupTests.ts"
Expand Down
58 changes: 58 additions & 0 deletions pages/docs/components/Modal.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Description, Meta, Props } from 'docsComponents';
import { Alert } from 'maeven';

<Meta title="Modal" />

# Modal

<Description of="Modal" />

<Alert type="warning" title="Warning!" closable={false}>
Modal relies on resize-observers. Older browsers need a polyfill.
</Alert>

## Props

<Props of="Modal" />

## Examples

### Basic

A basic usage of Modal.

```js live withRender
const ModalComp = () => {
[isOpen, setOpen] = useState(false);

return (
<>
<Modal
icon={userCircleSolid}
title="Hello World"
isOpen={isOpen}
maximizable
onClose={() => setOpen(false)}
color="primary"
>
<P>
Don't be too proud of this technological terror you've constructed.
The ability to destroy a planet is insignificant next to the power of
the Force. But with the blast shield down, I can't even see! How am I
supposed to fight?
</P>
<Ol>
<Li>
You are a part of the Rebel Alliance and a traitor! Take her away!
</Li>
<Li>The Force is strong with this one. I have you now.</Li>
<Li>He is here.</Li>
</Ol>
</Modal>
<Button onClick={() => setOpen(true)}>Open</Button>
</>
);
};
render(<ModalComp />);
```
1 change: 1 addition & 0 deletions pages/docs/nav.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
},
"Icon": "/docs/components/Icon",
"Link": "/docs/components/Link",
"Modal": "/docs/components/Modal",
"Spinner": "/docs/components/Spinner",
"ThemeProvider": "/docs/components/ThemeProvider"
}
Expand Down
101 changes: 98 additions & 3 deletions src/common/defaultIcons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { MaevenIcon } from '../types';
* Default Icons used for components.
*
* check, chevronDown, ChevronLeft, ChevronRight chevronUp,
* close, danger, info,minus, passwordShow, passwordHide,
* success, warning icons are licensed under the MIT
* License by Feather Icons: https://feathericons.com
* close, danger, info, maximize, minimize, minus,
* passwordShow, passwordHide, success, warning icons are
* licensed under the MIT License by Feather Icons:
* https://feathericons.com
*/

export const check: MaevenIcon = {
Expand Down Expand Up @@ -245,6 +246,100 @@ export const info: MaevenIcon = {
]
};

export const maximize: MaevenIcon = {
tag: 'svg',
attrs: {
xmlns: 'http://www.w3.org/2000/svg',
width: 24,
height: 24,
viewBox: '0 0 24 24',
fill: 'none',
stroke: 'currentColor',
strokeWidth: 2,
strokeLinecap: 'round',
strokeLinejoin: 'round'
},
children: [
{
tag: 'polyline',
attrs: {
points: '15 3 21 3 21 9'
}
},
{
tag: 'polyline',
attrs: {
points: '9 21 3 21 3 15'
}
},
{
tag: 'line',
attrs: {
x1: '21',
y1: '3',
x2: '14',
y2: '10'
}
},
{
tag: 'line',
attrs: {
x1: '3',
y1: '21',
x2: '10',
y2: '14'
}
}
]
};

export const minimize: MaevenIcon = {
tag: 'svg',
attrs: {
xmlns: 'http://www.w3.org/2000/svg',
width: 24,
height: 24,
viewBox: '0 0 24 24',
fill: 'none',
stroke: 'currentColor',
strokeWidth: 2,
strokeLinecap: 'round',
strokeLinejoin: 'round'
},
children: [
{
tag: 'polyline',
attrs: {
points: '4 14 10 14 10 20'
}
},
{
tag: 'polyline',
attrs: {
points: '20 10 14 10 14 4'
}
},
{
tag: 'line',
attrs: {
x1: '14',
y1: '10',
x2: '21',
y2: '3'
}
},
{
tag: 'line',
attrs: {
x1: '3',
y1: '21',
x2: '10',
y2: '14'
}
}
]
};

export const minus: MaevenIcon = {
tag: 'svg',
attrs: {
Expand Down
Loading

0 comments on commit 00795eb

Please sign in to comment.