-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/go_modules/server/src/main/github…
….com/golang-migrate/migrate/v4-4.18.1
- Loading branch information
Showing
16 changed files
with
872 additions
and
590 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,114 @@ | ||
@import "constants/style"; | ||
|
||
.color-picker { | ||
z-index: $menu-item-z-index; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
padding-bottom: $spacing--xxs; | ||
box-shadow: 0 0 20px rgba($navy--400, 0.12); | ||
background-color: $gray--300; | ||
list-style: none; | ||
padding-left: 0; | ||
margin-top: auto; | ||
border-radius: $rounded--full; | ||
|
||
&__item { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
&-button { | ||
cursor: pointer; | ||
border: none; | ||
background: none; | ||
padding: 0; | ||
width: 40px; | ||
height: 40px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
&:focus-within { | ||
> .column__header-color-option { | ||
border: 3px solid var(--accent-color--100); | ||
} | ||
} | ||
|
||
&:focus-visible { | ||
border-radius: $rounded--full; | ||
outline: none; | ||
} | ||
} | ||
} | ||
} | ||
|
||
[theme="dark"] { | ||
.color-picker { | ||
background-color: $navy--600; | ||
|
||
&__item { | ||
&__button { | ||
&:focus-visible { | ||
border-radius: $rounded--full; | ||
outline: none; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
.column__header-color-option { | ||
width: 24px; | ||
height: 24px; | ||
border-radius: $rounded--full; | ||
background-color: var(--accent-color--400); | ||
border: 3px solid $gray--300; | ||
|
||
&--selected { | ||
background-color: var(--accent-color--400); | ||
border: 3px solid var(--accent-color--200); | ||
} | ||
|
||
&:hover, | ||
&:focus-visible { | ||
background-color: var(--accent-color--400); | ||
border: 3px solid var(--accent-color--100); | ||
} | ||
} | ||
|
||
[theme="dark"] { | ||
.column__header-color-option { | ||
border: 3px solid $navy--600; | ||
|
||
&--selected { | ||
border: 3px solid var(--accent-color--200); | ||
} | ||
|
||
&:hover, | ||
&:focus-visible { | ||
border: 3px solid var(--accent-color--100); | ||
} | ||
} | ||
} | ||
|
||
.fix-focus-lock-placement { | ||
margin-top: auto; | ||
} | ||
|
||
@media #{$smartphone} { | ||
.color-picker { | ||
flex-direction: row-reverse; | ||
position: absolute; | ||
right: 0; | ||
margin: auto; | ||
justify-self: center; | ||
padding-right: $spacing--xxs; | ||
} | ||
|
||
.fix-focus-lock-placement { | ||
margin-top: initial; | ||
margin-bottom: auto; | ||
} | ||
} |
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,77 @@ | ||
import {useEffect} from "react"; | ||
import {useDispatch} from "react-redux"; | ||
import {uniqueId} from "underscore"; | ||
import ReactFocusLock from "react-focus-lock"; | ||
import {Color, getColorClassName, formatColorName} from "constants/colors"; | ||
import {Actions} from "../../store/action"; | ||
import {Tooltip} from "../Tooltip"; | ||
|
||
type ColorPickerProps = { | ||
id: string; | ||
name: string; | ||
visible: boolean; | ||
index: number; | ||
color: Color; | ||
onClose?: () => void; | ||
colors: Color[]; | ||
closeColorPicker: () => void; | ||
}; | ||
|
||
export const ColorPicker = (props: ColorPickerProps) => { | ||
const dispatch = useDispatch(); | ||
const colorsWithoutSelectedColor = props.colors.filter((curColor) => curColor !== props.color); | ||
const primColorAnchor = uniqueId(`color-picker-${props.color.toString()}`); | ||
|
||
useEffect(() => { | ||
const handleKeyPress = (e: KeyboardEvent) => { | ||
if (e.key === "Escape") { | ||
e.stopPropagation(); | ||
props.closeColorPicker(); | ||
} | ||
}; | ||
|
||
document.addEventListener("keydown", handleKeyPress, true); // trigger in capture phase | ||
return () => document.removeEventListener("keydown", handleKeyPress, true); | ||
}, [props]); | ||
|
||
return ( | ||
<ReactFocusLock autoFocus={false} className="fix-focus-lock-placement"> | ||
<ul className="color-picker"> | ||
<li className={`${getColorClassName(props.color)} color-picker__item`}> | ||
<button | ||
id={primColorAnchor} | ||
aria-label={formatColorName(props.color)} | ||
title={formatColorName(props.color)} | ||
onClick={() => { | ||
props.onClose?.(); | ||
dispatch(Actions.editColumn(props.id, {name: props.name, color: props.color, index: props.index, visible: props.visible})); | ||
}} | ||
className="color-picker__item-button" | ||
> | ||
<div className="column__header-color-option column__header-color-option--selected" /> | ||
</button> | ||
<Tooltip anchorSelect={`#${primColorAnchor}`} content={formatColorName(props.color)} /> | ||
</li> | ||
{colorsWithoutSelectedColor.map((item) => { | ||
const anchor = uniqueId(`color-picker-${item.toString()}`); | ||
return ( | ||
<li className={`${getColorClassName(item)} color-picker__item`}> | ||
<button | ||
id={anchor} | ||
aria-label={formatColorName(item)} | ||
title={formatColorName(item)} | ||
onClick={() => { | ||
props.onClose?.(); | ||
dispatch(Actions.editColumn(props.id, {name: props.name, color: item, index: props.index, visible: props.visible})); | ||
}} | ||
className={`${item.toString()} color-picker__item-button`} | ||
> | ||
<div className={`column__header-color-option column__header-color-option--${item.toString()}`} /> | ||
</button> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
</ReactFocusLock> | ||
); | ||
}; |
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.