-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Leshe4ka
committed
May 17, 2024
1 parent
42c236d
commit 3c89d07
Showing
11 changed files
with
248 additions
and
14 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
50 changes: 50 additions & 0 deletions
50
frontend/src/components/Nav/Menu/MenuColorPicker/MenuColorPicker.styled.ts
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,50 @@ | ||
import styled from 'styled-components'; | ||
import { ClusterColorKey } from 'theme/theme'; | ||
|
||
export const Container = styled.div` | ||
display: grid; | ||
grid-template-columns: repeat(5, 1fr); | ||
grid-template-rows: repeat(2, auto); | ||
padding: 0 8px; | ||
gap: 8px; | ||
border-radius: 8px; | ||
cursor: auto; | ||
`; | ||
|
||
export const ColorCircle = styled.div<{ $colorKey: ClusterColorKey }>` | ||
width: 16px; | ||
height: 16px; | ||
border-radius: 50%; | ||
margin: 4px; | ||
background-color: ${({ $colorKey, theme }) => | ||
theme.clusterColorPicker.backgroundColor[$colorKey]}; | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
&:hover { | ||
outline: ${({ theme }) => `1px solid ${theme.clusterColorPicker.outline}`}; | ||
} | ||
&:active { | ||
outline: ${({ theme }) => `2px solid ${theme.clusterColorPicker.outline}`}; | ||
} | ||
${({ $colorKey, theme }) => | ||
$colorKey === 'transparent' && | ||
` | ||
border: 1px solid ${theme.clusterColorPicker.transparentCircle.border}; | ||
&:before { | ||
content: '\\2716'; | ||
font-size: 8px; | ||
color: ${theme.clusterColorPicker.transparentCircle.cross}; | ||
} | ||
&:hover { | ||
border: none; | ||
} | ||
&:active { | ||
border: none; | ||
} | ||
`} | ||
`; |
45 changes: 45 additions & 0 deletions
45
frontend/src/components/Nav/Menu/MenuColorPicker/MenuColorPicker.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,45 @@ | ||
import React from 'react'; | ||
import { Dropdown } from 'components/common/Dropdown'; | ||
import ColorPickerIcon from 'components/common/Icons/ColorPickerIcon'; | ||
import { ClusterColorKey } from 'theme/theme'; | ||
|
||
import * as S from './MenuColorPicker.styled'; | ||
|
||
interface MenuColorPickerProps { | ||
setColorKey: (key: ClusterColorKey) => void; | ||
} | ||
|
||
const COLOR_KEYS: ClusterColorKey[] = [ | ||
'transparent', | ||
'gray', | ||
'red', | ||
'orange', | ||
'lettuce', | ||
'green', | ||
'turquoise', | ||
'blue', | ||
'violet', | ||
'pink', | ||
]; | ||
|
||
const MenuColorPicker = ({ setColorKey }: MenuColorPickerProps) => { | ||
const handleCircleCLick = (colorKey: ClusterColorKey) => () => { | ||
setColorKey(colorKey); | ||
}; | ||
|
||
return ( | ||
<Dropdown offsetY={5} label={<ColorPickerIcon />}> | ||
<S.Container> | ||
{COLOR_KEYS.map((key) => ( | ||
<S.ColorCircle | ||
onClick={handleCircleCLick(key)} | ||
$colorKey={key} | ||
key={key} | ||
/> | ||
))} | ||
</S.Container> | ||
</Dropdown> | ||
); | ||
}; | ||
|
||
export default MenuColorPicker; |
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
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 @@ | ||
import React from 'react'; | ||
|
||
const ColorPickerIcon: React.FC = () => { | ||
return ( | ||
<svg | ||
width="16" | ||
height="16" | ||
viewBox="0 0 16 16" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<circle | ||
cx="8" | ||
cy="8" | ||
r="5.5" | ||
fill="url(#paint0_linear_6232_2411)" | ||
stroke="white" | ||
/> | ||
<defs> | ||
<linearGradient | ||
id="paint0_linear_6232_2411" | ||
x1="3" | ||
y1="8" | ||
x2="13" | ||
y2="8" | ||
gradientUnits="userSpaceOnUse" | ||
> | ||
<stop stopColor="#FFA012" /> | ||
<stop offset="0.485" stopColor="#00D5A2" /> | ||
<stop offset="1" stopColor="#127FFF" /> | ||
</linearGradient> | ||
</defs> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default ColorPickerIcon; |
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
Oops, something went wrong.