-
Notifications
You must be signed in to change notification settings - Fork 11
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
Andrei Firsov
committed
Oct 5, 2018
1 parent
79a4968
commit 4ab8592
Showing
6 changed files
with
208 additions
and
46 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 |
---|---|---|
@@ -1,43 +1,63 @@ | ||
import React from 'react'; | ||
|
||
import { createStyledTag, createTheme } from '../../utils'; | ||
import { GREY_COLORS } from '../../theme/dsmColors'; | ||
import { SizeContext } from './SizeContext'; | ||
|
||
type MenuItemProps = {| | ||
children?: React$Node, | ||
|}; | ||
|
||
const name = 'menuItem'; | ||
const NAME = 'menuItem'; | ||
|
||
const theme = createTheme(name, { | ||
const theme = createTheme(NAME, { | ||
modifiers: { | ||
size: { | ||
s: { | ||
height: '3.2rem', | ||
lineHeight: '3.2rem', | ||
paddingRight: '1.6rem', | ||
paddingLeft: '1.6rem', | ||
}, | ||
m: { | ||
height: '4rem', | ||
lineHeight: '2.3rem', | ||
paddingRight: '1.9rem', | ||
paddingLeft: '1.9rem', | ||
}, | ||
}, | ||
}, | ||
defaults: { | ||
size: 's', | ||
}, | ||
}); | ||
|
||
const StyledTag = createStyledTag(name, () => ({ | ||
color: 'rgba(0, 0, 0, 0.87)', | ||
const StyledTag = createStyledTag(NAME, () => ({ | ||
color: GREY_COLORS.DARK_GREY_2, | ||
fontFamily: 'Poppins', | ||
fontSize: '14px', | ||
fontWeight: 400, | ||
height: '2rem', | ||
display: 'flex', | ||
alignItems: 'center', | ||
cursor: 'pointer', | ||
padding: '0 1rem', | ||
whiteSpace: 'nowrap', | ||
|
||
'&:hover': { | ||
backgroundColor: '#4DA1FF', | ||
color: '#fff', | ||
backgroundColor: GREY_COLORS.LIGHT_GREY_3, | ||
color: GREY_COLORS.BLACK, | ||
}, | ||
})); | ||
|
||
function MenuItem({ | ||
children, | ||
...rest | ||
}: MenuItemProps) { | ||
return <StyledTag { ...rest } tagName="div">{ children }</StyledTag>; | ||
} | ||
const MenuItem = ({ children, ...rest }: MenuItemProps) => ( | ||
<SizeContext.Consumer> | ||
{ size => ( | ||
<StyledTag tagName="div" size={ size } { ...rest } > | ||
{ children } | ||
</StyledTag> | ||
) } | ||
</SizeContext.Consumer> | ||
); | ||
|
||
MenuItem.displayName = 'Menu.Item'; | ||
|
||
export { MenuItem, theme }; |
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,36 +1,52 @@ | ||
import React from 'react'; | ||
|
||
import { createStyledTag, createTheme } from '../../utils'; | ||
import { GREY_COLORS } from '../../theme/dsmColors'; | ||
import { SizeContext } from './SizeContext'; | ||
|
||
type MenuPlateProps = {| | ||
children?: React$Node, | ||
size?: 's' | 'm', | ||
|}; | ||
|
||
const name = 'menuPlate'; | ||
const NAME = 'menuPlate'; | ||
|
||
const theme = createTheme(name, { | ||
const theme = createTheme(NAME, { | ||
modifiers: { | ||
size: { | ||
s: { | ||
borderRadius: '0 0 .5rem .5rem', | ||
}, | ||
m: { | ||
marginTop: '.8rem', | ||
paddingTop: '.8rem', | ||
paddingBottom: '.8rem', | ||
borderRadius: '.5rem', | ||
boxShadow: '0 .4rem .8rem 0 rgba(0, 0, 0, 0.04)', | ||
}, | ||
}, | ||
}, | ||
defaults: { | ||
size: 's', | ||
}, | ||
}); | ||
|
||
const StyledTag = createStyledTag(name, () => ({ | ||
const StyledTag = createStyledTag(NAME, () => ({ | ||
backgroundColor: '#fff', | ||
border: '1px solid #d0d7dd', | ||
borderRadius: '5px', | ||
padding: '1rem 0', | ||
boxSizing: 'border-box', | ||
border: `.1rem solid ${GREY_COLORS.LIGHT_GREY_1}`, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
})); | ||
|
||
function MenuPlate({ | ||
children, | ||
...rest | ||
}: MenuPlateProps) { | ||
return ( | ||
<StyledTag { ...rest } tagName="div">{ children }</StyledTag> | ||
); | ||
} | ||
const MenuPlate = ({ children, ...rest }: MenuPlateProps) => ( | ||
<StyledTag tagName="div" { ...rest } > | ||
<SizeContext.Provider value={ rest.size }> | ||
{ children } | ||
</SizeContext.Provider> | ||
</StyledTag> | ||
); | ||
|
||
MenuPlate.displayName = 'Menu.Plate'; | ||
|
||
export { MenuPlate, theme }; |
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,4 @@ | ||
import { createContext } from 'react'; | ||
|
||
export const SizeContext = createContext(); | ||
|
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,37 @@ | ||
export const GREY_COLORS = { | ||
BLACK: '#323c47', | ||
DARK_GREY_1: '#7e828b', | ||
DARK_GREY_2: '#939ea7', | ||
DARK_GREY_3: '#a5afb6', | ||
LIGHT_GREY_1: '#d0d7dd', | ||
LIGHT_GREY_2: '#e9eff4', | ||
LIGHT_GREY_3: '#f4f5f6', | ||
}; | ||
|
||
export const MAIN_BRAND_COLORS = { | ||
BLUE: '#4da1ff', | ||
CHARCOAL: '#323c47', | ||
RED: '#eb4235', | ||
YELLOW: '#ffd012', | ||
}; | ||
|
||
export const NAVIGATION_COLORS = { | ||
DB: '#323c47', | ||
DB_SELECTED: '#1c252e', | ||
HOME: '#4da1ff', | ||
HOME_SELECTED: '#1f7ae0', | ||
SETTINGS: '#687695', | ||
SETTINGS_SELECTED: '#4d5a78', | ||
}; | ||
|
||
export const SECONDARY_COLORS = { | ||
CORAL: '#f17b71', | ||
DARK_BLUE: '#1968cb', | ||
GREEN: '#00bb6e', | ||
MAGENTA: '#ea518e', | ||
NEON: '#a6e50f', | ||
ORANGE: '#ff6d4a', | ||
PURPLE: '#9975d0', | ||
SPACE: '#687695', | ||
}; | ||
|
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