This repository has been archived by the owner on Nov 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
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 #133 from jamesplease/dialog
adding dialog and docs
- Loading branch information
Showing
11 changed files
with
168 additions
and
11 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,22 @@ | ||
class DialogExample extends Component { | ||
render() { | ||
return ( | ||
<Dialog style={{ maxWidth: '500px' }}> | ||
<Dialog.Title>Dialog Title</Dialog.Title> | ||
<Dialog.Body> | ||
<p> | ||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Numquam | ||
consequatur enim voluptates nobis perferendis voluptatibus alias | ||
modi voluptate dolorum ipsa amet. | ||
</p> | ||
</Dialog.Body> | ||
<Dialog.Actions> | ||
<Button flat>Cancel</Button> | ||
<Button flat>Accept</Button> | ||
</Dialog.Actions> | ||
</Dialog> | ||
); | ||
} | ||
} | ||
|
||
return <DialogExample />; |
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,27 @@ | ||
## Usage | ||
|
||
```jsx | ||
import { Dialog } from 'materialish'; | ||
import 'materialish/dialog.css'; | ||
``` | ||
|
||
Take note of the fact that a dialog is made up of several components. To see how they | ||
are used together, refer to the example above. | ||
|
||
## Props | ||
|
||
All of the components of a dialog receive the same props. | ||
|
||
| Prop Name | Default Value | Required | Description | | ||
| --------- | ------------- | -------- | ------------------------------------------------------------------ | | ||
| className | | No | Additional class name(s) to add to the dialog component | | ||
| ...rest | | No | Other props are placed on the root element of the dialog component | | ||
|
||
## CSS Variables | ||
|
||
These CSS variables should be applied to the `<Dialog/>` component, and not the sub-components. | ||
|
||
| Variable | Default Value | Description | | ||
| ----------------- | ------------- | ------------------------------------------------------ | | ||
| --mt-baseFontSize | 1rem | The text size of the dialog is based off of this value | | ||
| --mt-fontFamily | 'Roboto' | The font family to use for text | |
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,30 @@ | ||
.mt-dialog { | ||
font-family: var(--mt-fontFamily, 'Roboto'); | ||
font-size: var(--mt-baseFontSize, 1rem); | ||
background-color: #fff; | ||
text-align: left; | ||
box-shadow: 0 11px 15px -7px rgba(0, 0, 0, 0.2), 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12); | ||
border-radius: 0.125em; | ||
} | ||
|
||
.mt-dialog_title { | ||
color: #212121; | ||
font-size: 1.25em; | ||
padding: 1.2em 1.2em 0; | ||
font-weight: 500; | ||
} | ||
|
||
.mt-dialog_content { | ||
color: #757575; | ||
margin: 1.25em 1.5em 1.5em; | ||
} | ||
|
||
.mt-dialog_actions { | ||
padding: 0.5em; | ||
display: flex; | ||
justify-content: flex-end; | ||
} | ||
|
||
.mt-dialog_actions .mt-button+.mt-button { | ||
margin-left: 0.43em; | ||
} |
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,26 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
class Dialog extends Component { | ||
static Title = ({ className = '', ...props }) => ( | ||
<div className={`mt-dialog_title ${className}`} {...props} /> | ||
); | ||
static Body = ({ className = '', ...props }) => ( | ||
<div className={`mt-dialog_content ${className}`} {...props} /> | ||
); | ||
|
||
static Actions = ({ className = '', ...props }) => ( | ||
<div className={`mt-dialog_actions ${className}`} {...props} /> | ||
); | ||
|
||
render() { | ||
const { className = '', ...props } = this.props; | ||
return <div className={`mt-dialog ${className}`} {...props} />; | ||
} | ||
} | ||
|
||
Dialog.propTypes = { | ||
className: PropTypes.string, | ||
}; | ||
|
||
export default Dialog; |
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,30 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { setOptions } from '@storybook/addon-options'; | ||
import '../src/dialog/dialog.css'; | ||
import { Dialog } from '../src/index'; | ||
import { Button } from '../src/index'; | ||
|
||
setOptions({ | ||
name: 'Materialish', | ||
addonPanelInRight: true, | ||
}); | ||
|
||
storiesOf('Dialog', module).add('Regular', () => ( | ||
<Dialog> | ||
<Dialog.Title>I am a modal</Dialog.Title> | ||
<Dialog.Body> | ||
<p> | ||
Lorem ipsum dolor sit amet consectetur adipisicing elit. Numquam | ||
consequatur enim voluptates nobis perferendis voluptatibus alias modi | ||
voluptate dolorum ipsa amet, aliquam similique blanditiis iusto ipsam, | ||
atque beatae aliquid sit! Lorem ipsum dolor sit amet consectetur | ||
adipisicing elit. | ||
</p> | ||
</Dialog.Body> | ||
<Dialog.Actions> | ||
<Button flat>Nevermind</Button> | ||
<Button flat>Accept</Button> | ||
</Dialog.Actions> | ||
</Dialog> | ||
)); |