Skip to content

Commit

Permalink
feat(atoms): add borderRadius modifier to the Paper
Browse files Browse the repository at this point in the history
  • Loading branch information
ej9x committed Sep 19, 2018
1 parent 04fc21b commit bead39e
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/atoms/Paper/Paper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@ import React from 'react';
import { createStyledTag, createTheme, getThemeStyle } from '../../utils';
import type { PropSizes } from '../../types';

type PaperProps = {|
type PaperProps = {
children?: React$Node,
/** possible padding */
padding?: PropSizes | 'xxl',
/** when true then stetch cpontainer to the parent */
stretch?: boolean,
/** modifier to regulate border radius */
borderRadius?: 'top' | 'bottom' | 'all',
/** custom styles */
style?: Object,
|};
};

const name = 'paper';

const theme = createTheme(name, (colors: *, sizes: *): * => ({
paper: {
background: colors.WHITE,
color: colors.BLACK,
borderRadius: sizes.MAIN_BORDER_RADIUS,
boxShadow: '0 1px 3px 0 rgba(50,50,93,.14), 0 4px 6px 0 rgba(112,157,199,.08)',
position: 'relative',
},
Expand All @@ -32,14 +37,29 @@ const theme = createTheme(name, (colors: *, sizes: *): * => ({
xl: { padding: '4rem' },
xxl: { padding: '8rem' },
},
borderRadius: {
top: {
borderTopLeftRadius: sizes.MAIN_BORDER_RADIUS,
borderTopRightRadius: sizes.MAIN_BORDER_RADIUS,
},
bottom: {
borderBottomLeftRadius: sizes.MAIN_BORDER_RADIUS,
borderBottomhtRadius: sizes.MAIN_BORDER_RADIUS,
},
all: {
borderRadius: sizes.MAIN_BORDER_RADIUS,
},
},
stretch: {
flex: 1,
width: '100%',
height: '100%',
},
},

defaults: {
padding: 'none',
borderRadius: 'all',
},
}));

Expand All @@ -57,4 +77,6 @@ function Paper({
return <StyledTag { ...rest } tagName="div">{ children }</StyledTag>;
}

Paper.defaultProps = theme[name].defaults;

export { Paper, theme };

0 comments on commit bead39e

Please sign in to comment.