-
Notifications
You must be signed in to change notification settings - Fork 138
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
1 parent
9ac1a87
commit 9f1f0f4
Showing
5 changed files
with
113 additions
and
14 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/components/molecules/QuickActionCompare/QuickActionCompare.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,28 @@ | ||
import React, {useCallback} from 'react'; | ||
|
||
import {useAppDispatch} from '@redux/hooks'; | ||
import {ComparisonView, compareToggled} from '@redux/reducers/compare'; | ||
|
||
import * as S from './styled'; | ||
|
||
export const QuickActionCompare = (props: {isItemSelected: boolean; view: ComparisonView}) => { | ||
const {isItemSelected, view} = props; | ||
|
||
const dispatch = useAppDispatch(); | ||
const handleCompare = useCallback(() => { | ||
dispatch( | ||
compareToggled({ | ||
value: true, | ||
initialView: view, | ||
}) | ||
); | ||
}, [dispatch, view]); | ||
|
||
return ( | ||
<S.Container> | ||
<S.PreviewSpan isItemSelected={isItemSelected} onClick={handleCompare}> | ||
Compare | ||
</S.PreviewSpan> | ||
</S.Container> | ||
); | ||
}; |
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 @@ | ||
export * from './QuickActionCompare'; |
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,35 @@ | ||
import {Spin as RawSpin} from 'antd'; | ||
|
||
import {LoadingOutlined} from '@ant-design/icons'; | ||
|
||
import styled from 'styled-components'; | ||
|
||
import Colors from '@styles/Colors'; | ||
|
||
export const PreviewLoadingIcon = <LoadingOutlined style={{fontSize: 16}} spin />; | ||
|
||
export const PreviewSpan = styled.span<{isItemSelected: boolean}>` | ||
font-weight: 500; | ||
font-size: 12px; | ||
cursor: pointer; | ||
color: ${props => (props.isItemSelected ? Colors.blackPure : Colors.blue6)}; | ||
margin-left: 5px; | ||
margin-right: 15px; | ||
`; | ||
|
||
export const ReloadSpan = styled.span<{isItemSelected: boolean}>` | ||
margin-right: 15px; | ||
font-size: 12px; | ||
font-weight: 500; | ||
cursor: pointer; | ||
color: ${props => (props.isItemSelected ? Colors.blackPure : Colors.blue6)}; | ||
`; | ||
|
||
export const Container = styled.span` | ||
display: flex; | ||
align-items: center; | ||
`; | ||
|
||
export const Spin = styled(RawSpin)` | ||
margin-right: 15px; | ||
`; |
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