-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(layer-selector): add new layer selector (#271)
* feat(layer-selector): add new layer selector * style(layer-selector): use emCalc * refactor(layer-selector): change from span to button, rename * refactor(layer-selector): change types
- Loading branch information
1 parent
5e7bcd0
commit 8f9d1e5
Showing
21 changed files
with
320 additions
and
161 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,15 @@ | ||
export const SHOW_LAYER_SELECTOR = 'SHOW_LAYER_SELECTOR'; | ||
|
||
export interface ShowLayerSelectorAction { | ||
type: typeof SHOW_LAYER_SELECTOR; | ||
showLayerSelector: boolean; | ||
} | ||
|
||
const showLayerSelectorAction = ( | ||
showLayerSelector: boolean | ||
): ShowLayerSelectorAction => ({ | ||
type: SHOW_LAYER_SELECTOR, | ||
showLayerSelector | ||
}); | ||
|
||
export default showLayerSelectorAction; |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.button | ||
display: flex | ||
align-items: center | ||
padding: 0 | ||
outline: 0 | ||
border: none | ||
background: none | ||
|
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,12 @@ | ||
import React, {FunctionComponent} from 'react'; | ||
|
||
export const CloseIcon: FunctionComponent = () => ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24"> | ||
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" /> | ||
<path d="M0 0h24v24H0z" fill="none" /> | ||
</svg> | ||
); |
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
31 changes: 31 additions & 0 deletions
31
src/scripts/components/layer-list-item/layer-list-item.styl
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,31 @@ | ||
@require '../../../variables.styl' | ||
|
||
.layerItem | ||
display: flex | ||
justify-content: space-between | ||
align-items: center | ||
padding: emCalc(11px) emCalc(32px) | ||
color: $textDefault | ||
|
||
&:hover, &:focus | ||
background-color: rgba($darkGrey4, 0.5) | ||
|
||
.compare | ||
display: block | ||
|
||
.compare | ||
display: none | ||
border: none | ||
background: none | ||
color: $textDefault | ||
text-transform: uppercase | ||
font-size: emCalc(11px) | ||
cursor: pointer | ||
|
||
&:hover, &:focus | ||
color: $textColor | ||
|
||
.layerTitle | ||
display: flex | ||
align-items: center | ||
cursor: pointer |
36 changes: 36 additions & 0 deletions
36
src/scripts/components/layer-list-item/layer-list-item.tsx
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,36 @@ | ||
import React, {FunctionComponent} from 'react'; | ||
import {FormattedMessage} from 'react-intl'; | ||
|
||
import {LayerListItem as LayerListItemType} from '../../types/layer-list'; | ||
|
||
import styles from './layer-list-item.styl'; | ||
|
||
interface Props { | ||
layer: LayerListItemType; | ||
isMainSelected: boolean; | ||
onMainSelect: (id: string) => void; | ||
onCompareSelect: (id: string) => void; | ||
} | ||
|
||
const LayerListItem: FunctionComponent<Props> = ({ | ||
layer, | ||
isMainSelected, | ||
onMainSelect, | ||
onCompareSelect | ||
}) => ( | ||
<div className={styles.layerItem} onClick={() => onMainSelect(layer.id)}> | ||
<span className={styles.layerTitle}>{layer.name}</span> | ||
{isMainSelected && ( | ||
<button | ||
className={styles.compare} | ||
onClick={event => { | ||
onCompareSelect(layer.id); | ||
event.stopPropagation(); | ||
}}> | ||
<FormattedMessage id={'layerSelector.compare'} /> | ||
</button> | ||
)} | ||
</div> | ||
); | ||
|
||
export default LayerListItem; |
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 |
---|---|---|
@@ -1,2 +1,30 @@ | ||
.layerContainer | ||
padding: 0 10px 0 10px | ||
@require '../../../variables.styl' | ||
|
||
.layerSelector | ||
position: absolute | ||
top: 0 | ||
right: 0 | ||
display: flex | ||
flex-direction: column | ||
min-width: emCalc(300px) | ||
max-width: emCalc(500px) | ||
width: 33% | ||
height: 100% | ||
background-color: $darkGrey2 | ||
|
||
.header | ||
display: flex | ||
justify-content: space-between | ||
align-items: center | ||
padding: emCalc(24px) emCalc(32px) | ||
background-color: $darkGrey1 | ||
color: white | ||
|
||
.button | ||
svg | ||
padding: 0 | ||
|
||
.title | ||
margin: 0 | ||
text-transform: uppercase | ||
font-size: emCalc(18px) |
Oops, something went wrong.