generated from arvinxx/monorepo-template
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
6 changed files
with
103 additions
and
72 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,42 @@ | ||
import type { FC } from 'react'; | ||
import React, { memo } from 'react'; | ||
import reactCSS from 'reactcss'; | ||
import isEqual from 'lodash/isEqual'; | ||
|
||
import { Checkboard } from '../common'; | ||
|
||
import { useStore } from '../../store'; | ||
import type { ColorPickerProps } from '../../types'; | ||
|
||
export const Previewer: FC<ColorPickerProps> = memo(() => { | ||
const rgba = useStore((s) => s.colorModel.rgba(), isEqual); | ||
|
||
const styles: any = reactCSS({ | ||
default: { | ||
color: { | ||
width: '24px', | ||
height: '24px', | ||
position: 'relative', | ||
marginTop: '4px', | ||
marginLeft: '4px', | ||
borderRadius: 12, | ||
overflow: 'hidden', | ||
}, | ||
activeColor: { | ||
borderRadius: 12, | ||
absolute: '0px 0px 0px 0px', | ||
background: `rgba(${rgba.join(',')})`, | ||
boxShadow: 'inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)', | ||
}, | ||
}, | ||
}); | ||
|
||
return ( | ||
<div style={styles.color}> | ||
<Checkboard /> | ||
<div style={styles.activeColor} /> | ||
</div> | ||
); | ||
}); | ||
|
||
export default Previewer; |
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
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