This repository was archived by the owner on Mar 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
132 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// @flow | ||
import React, { type Node } from 'react'; | ||
|
||
import _Pane from './styled'; | ||
|
||
type Props = { | ||
border: boolean | 'shadow', | ||
className?: string, | ||
children?: Node, | ||
isFullWidth?: boolean | ||
}; | ||
|
||
const Pane = ({ children, ...props }: Props) => <_Pane {...props}>{children}</_Pane>; | ||
|
||
Pane.defaultProps = { | ||
className: undefined, | ||
children: undefined, | ||
isFullWidth: false | ||
}; | ||
|
||
export default Pane; |
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,58 @@ | ||
--- | ||
name: Pane | ||
route: /layout/pane | ||
menu: Layout | ||
--- | ||
|
||
import { Playground, PropsTable } from 'docz'; | ||
import Pane from '../Pane'; | ||
|
||
# Pane | ||
|
||
## Import | ||
|
||
`import { Pane } from 'fannypack'` | ||
|
||
## Basic Usage | ||
|
||
A `<Pane>` is the same as a `<Box>`, except it has a default border radius, and has the ability to add different types of borders to it. Using `<Pane>` and `<Box>` together are most likely the two building blocks for the layout of your app. | ||
|
||
<Playground> | ||
<Pane backgroundColor="whiteDarker" padding="large">Hello world</Pane> | ||
</Playground> | ||
|
||
## Shadowed | ||
|
||
<Playground> | ||
<Pane border="shadow" padding="large">Hello world</Pane> | ||
</Playground> | ||
|
||
## Bordered | ||
|
||
<Playground> | ||
<Pane border padding="large">Hello world</Pane> | ||
</Playground> | ||
|
||
## Full width | ||
|
||
<Playground> | ||
<Pane border isFullWidth padding="large">Hello world</Pane> | ||
</Playground> | ||
|
||
## Props | ||
|
||
<PropsTable of={Pane} /> | ||
|
||
## Theming | ||
|
||
### Schema | ||
|
||
```jsx | ||
{ | ||
base: string | Object, | ||
border: { | ||
default: string | Object, | ||
shadow: string | Object | ||
} | ||
} | ||
``` |
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,2 @@ | ||
export { default } from './Pane'; | ||
export { default as Pane } from './Pane'; |
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,40 @@ | ||
import { palette, theme } from 'styled-tools'; | ||
import styled, { css } from '../styled'; | ||
import { Box } from '../primitives'; | ||
|
||
const Pane = styled(Box)` | ||
display: inline-flex; | ||
border-radius: 3px; | ||
flex-wrap: wrap; | ||
${props => | ||
props.border === 'shadow' && | ||
css` | ||
box-shadow: 0px 2px 4px 0px ${palette('whiteDarkest')}, 0px 0px 0px 1px ${palette('whiteDarkest')}; | ||
& { | ||
${theme('fannypack.Pane.border.shadow')}; | ||
} | ||
`}; | ||
${props => | ||
props.border === true && | ||
css` | ||
border: 1px solid ${palette('whiteDarkest')}; | ||
& { | ||
${theme('fannypack.Pane.border.default')}; | ||
} | ||
`}; | ||
${props => | ||
props.isFullWidth && | ||
css` | ||
width: 100%; | ||
margin-right: 0px !important; | ||
`}; | ||
& { | ||
${theme('fannypack.Pane.base')}; | ||
} | ||
`; | ||
|
||
export default Pane; |
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