-
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.
refactor(data-set-info): disable data set info in story mode
- Loading branch information
1 parent
32d1443
commit f74adc0
Showing
5 changed files
with
42 additions
and
28 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
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,24 +1,47 @@ | ||
import React, {FunctionComponent} from 'react'; | ||
import RemoveCompare from '../remove-compare/remove-compare'; | ||
import {useParams} from 'react-router-dom'; | ||
import {useSelector} from 'react-redux'; | ||
|
||
import InfoButton from '../info-button/info-button'; | ||
import {State} from '../../reducers'; | ||
import {layerListItemSelector} from '../../selectors/layers/list-item'; | ||
import RemoveCompare from '../remove-compare/remove-compare'; | ||
|
||
import styles from './data-set-info.styl'; | ||
import {LayerListItem} from '../../types/layer-list'; | ||
|
||
import styles from './data-set-info.styl'; | ||
|
||
interface Props { | ||
isMain?: boolean; | ||
layer: LayerListItem | null; | ||
isCompare?: boolean; | ||
} | ||
|
||
const DataSetInfo: FunctionComponent<Props> = ({layer, isMain}) => ( | ||
<div className={styles.dataSetInfo}> | ||
const DataSetContent: FunctionComponent<Props> = ({layer, isCompare}) => ( | ||
<div className={styles.dataSetContent}> | ||
<h1 className={styles.title}>{layer?.name}</h1> | ||
<h2 className={styles.description}>{layer?.description}</h2> | ||
<div className={styles.buttons}> | ||
<InfoButton layer={layer} /> | ||
{!isMain && <RemoveCompare />} | ||
{isCompare && <RemoveCompare />} | ||
</div> | ||
</div> | ||
); | ||
|
||
const DataSetInfo: FunctionComponent = () => { | ||
const {mainLayerId, compareLayerId} = useParams(); | ||
const mainLayer = useSelector((state: State) => | ||
layerListItemSelector(state, mainLayerId) | ||
); | ||
const compareLayer = useSelector((state: State) => | ||
layerListItemSelector(state, compareLayerId) | ||
); | ||
|
||
return ( | ||
<div className={styles.dataSetInfo}> | ||
<DataSetContent layer={mainLayer} /> | ||
{compareLayer && <DataSetContent layer={compareLayer} isCompare />} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DataSetInfo; |
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