Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new column menu #4428

Merged
merged 86 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
1a713d8
create colorPicker dropdown
laila-rin Jul 23, 2024
6a29204
quick safe
laila-rin Jul 23, 2024
3bc3a8d
change order and a little bit of :sparkle: visual spice :sparkle:
laila-rin Jul 23, 2024
64ebeea
add rounded corners to pretty up the color picker drop down
laila-rin Jul 23, 2024
545e066
add in close button
laila-rin Jul 24, 2024
06367e4
add functionality to close button
laila-rin Jul 24, 2024
3a71296
clean up
laila-rin Jul 25, 2024
51d8627
adjusting visuals to fit figma design
laila-rin Jul 25, 2024
c87b6b0
quick save
laila-rin Jul 26, 2024
61cd54d
transfer css classes from ColumnSettings.scss to ColorPicker.scss and…
laila-rin Jul 30, 2024
e1e3d08
little more clean up
laila-rin Jul 30, 2024
8c27b0c
revert changes in docker-compose.yml
laila-rin Jul 30, 2024
0b680f3
fix color picker border
laila-rin Aug 7, 2024
a342928
try add tooltip
laila-rin Aug 7, 2024
aebd6f2
rotate settings icon, but the girl is still dancing when hovering
laila-rin Aug 8, 2024
8d9c3f1
integrate minimenu into columnsettings
laila-rin Aug 20, 2024
87f7fb2
change colorpicker layout
laila-rin Aug 20, 2024
f2fbc70
remove hardcoded colors in colorpicker
laila-rin Aug 21, 2024
d3c350e
fix colorpicker appearence and z-index
laila-rin Aug 21, 2024
f196d0e
move menu to right spot
laila-rin Aug 21, 2024
77ce2f5
add transform mixin for minimenu
laila-rin Aug 21, 2024
a7dc315
add dark theme to colorPicker
laila-rin Aug 22, 2024
8b352e1
rotate back edit icon
laila-rin Aug 22, 2024
b51563c
change tooltip color
laila-rin Aug 22, 2024
a30d6f0
add dark theme to minimenu
laila-rin Aug 22, 2024
3962f24
Merge remote-tracking branch 'refs/remotes/origin/main' into js/new-c…
laila-rin Aug 22, 2024
533d7aa
fix columnsettings z index
laila-rin Aug 22, 2024
53eda70
add flag for horizontal and vertical arrangement to colorpicker
laila-rin Aug 22, 2024
7028f12
start adding mobile view to change into vertical view
laila-rin Aug 22, 2024
33a702e
add rotation flags to mini menu and color picker
laila-rin Aug 22, 2024
6668652
Revert "add rotation flags to mini menu and color picker"
laila-rin Aug 23, 2024
cd1f7ea
Revert "start adding mobile view to change into vertical view"
laila-rin Aug 23, 2024
63eb732
Revert "add flag for horizontal and vertical arrangement to colorpicker"
laila-rin Aug 23, 2024
52dcaf4
add media query for rotation for smartphone version and remove mixins
laila-rin Aug 23, 2024
8641b18
add noshow for delete icon for last column
laila-rin Aug 23, 2024
de243d9
move ColorPicker component to own folder
laila-rin Aug 23, 2024
10e3df9
pr review changes
laila-rin Aug 27, 2024
5b6dd33
change color name in colorpicker aria label
laila-rin Aug 27, 2024
96b7914
add color variables to ColorPicker.scss and change css class naming t…
laila-rin Aug 27, 2024
5cab70b
extract menu items array to a constant
laila-rin Aug 27, 2024
fe4a465
add tooltip global instance instead of local ones
laila-rin Aug 28, 2024
7a5be99
add focus to MiniMenu.scss
laila-rin Aug 28, 2024
440bc61
correct padding in MiniMenu.scss
laila-rin Aug 28, 2024
341b167
add unfinished focus styling to ColorPicker.scss
laila-rin Aug 28, 2024
e6354a0
add unfinished focus styling to ColorPicker.scss
laila-rin Aug 28, 2024
66e9702
change focus to focus-visible in ColorPicker.scss
laila-rin Aug 29, 2024
acea03e
add jsx to auto focus first element
laila-rin Aug 29, 2024
644cf5d
remove jsx to auto focus first element
laila-rin Aug 30, 2024
b3f56f7
add functionality to close menu with esc key
laila-rin Aug 30, 2024
067a93e
add focuslock to MiniMenu.tsx
laila-rin Aug 30, 2024
fe15adf
refactor ColumnSettings.tsx
laila-rin Aug 30, 2024
75f1326
add functionality to close ColorPicker.tsx when excape is clicked
laila-rin Aug 30, 2024
9a16d0c
add focuslock to ColorPicker.tsx
laila-rin Aug 30, 2024
84ef541
trying to add colorful styling to focus-visible buttons and failing t…
laila-rin Aug 30, 2024
7f8d59e
reverting focus-visible button styling to gray
laila-rin Aug 30, 2024
5d58b7b
add focus-visible button styling to dark theme
laila-rin Aug 30, 2024
9fe87c7
Merge remote-tracking branch 'refs/remotes/origin/main' into js/new-c…
laila-rin Aug 30, 2024
077532a
change tab focus styling of ColorPicker.scss
laila-rin Sep 2, 2024
036911c
change eventlistener capturing phases to stop propagation of esc hand…
laila-rin Sep 3, 2024
4564141
fix alignment and padding in mobile view
laila-rin Sep 3, 2024
d4f76a4
remove focus ring for dark theme
laila-rin Sep 3, 2024
e915f5f
update snapshot
laila-rin Sep 3, 2024
1044dd4
lint openColorPicker dependency
laila-rin Sep 3, 2024
8bd1aea
update hardcoded z-index in ColumnSettings.scss
laila-rin Sep 9, 2024
25bbdb1
update duplicated css code to use global accent-color variables
laila-rin Sep 9, 2024
462afd9
refactor ColorPicker.scss
laila-rin Sep 10, 2024
fac9f57
update Column snapshot
laila-rin Sep 10, 2024
579d6f8
Merge remote-tracking branch 'refs/remotes/origin/main' into js/new-c…
laila-rin Sep 10, 2024
21022dd
Merge branch 'main' into js/new-column-menu
laila-rin Sep 10, 2024
3c07348
move formatColorName function to colors.ts
laila-rin Sep 12, 2024
2347dba
Merge remote-tracking branch 'origin/js/new-column-menu' into js/new-…
laila-rin Sep 12, 2024
8ff28f2
change column__header-color-option--selected class naming to apply to…
laila-rin Sep 13, 2024
bf7ae1d
add MiniMenuItem type to menuItem list in ColumnSettings.tsx
laila-rin Sep 13, 2024
46de4a6
small refactoring
laila-rin Sep 13, 2024
828ac8b
remove close icon when ColumnSettings is opened since it's overlayed
laila-rin Sep 13, 2024
5bd02a9
making sure colors are chosen equally
laila-rin Sep 13, 2024
4455363
remove flex-wrap so the MiniMenu doesn't wrap weirdly when there's to…
laila-rin Sep 13, 2024
0792ac4
Merge branch 'main' into js/new-column-menu
laila-rin Sep 13, 2024
12431d3
using module path for import
laila-rin Sep 13, 2024
1d3723d
Merge remote-tracking branch 'refs/remotes/origin/js/new-column-menu'…
laila-rin Sep 13, 2024
e6d0649
add comment to inline styling of ThreeDot icon rotation
laila-rin Sep 17, 2024
1e03e23
exchange css selectors for bem named classes
laila-rin Sep 17, 2024
efc0ab7
exchange css selectors for correct bem named classes
laila-rin Sep 17, 2024
02468cb
snapshot
Schwehn42 Sep 17, 2024
9ade5c3
Merge branch 'main' into js/new-column-menu
laila-rin Sep 17, 2024
886a194
Merge branch 'main' into js/new-column-menu
laila-rin Sep 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions src/components/ColorPicker/ColorPicker.scss
laila-rin marked this conversation as resolved.
Show resolved Hide resolved
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;
}
}
77 changes: 77 additions & 0 deletions src/components/ColorPicker/ColorPicker.tsx
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>
);
};
8 changes: 5 additions & 3 deletions src/components/Column/Column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ export const Column = ({id, name, color, visible, index}: ColumnProps) => {
<Close className="column__header-edit-button-icon" />
</button>
)}
{!isTemporary && (
{!isTemporary && !openedColumnSettings && (
<button title={t("Column.settings")} className="column__header-edit-button" onClick={() => setOpenedColumnSettings((o) => !o)}>
{openedColumnSettings ? <Close className="column__header-edit-button-icon" /> : <ThreeDots className="column__header-edit-button-icon" />}
<ThreeDots className="column__header-edit-button-icon" style={{transform: "rotate(90deg)"}} /> {/* inline style to avoid funky rotating behaviour when hovering */}
</button>
)}
</>
Expand Down Expand Up @@ -212,7 +212,7 @@ export const Column = ({id, name, color, visible, index}: ColumnProps) => {
{notes.length}
</span>
)}
{isModerator && renderColumnModifiers()}
{!openedColumnSettings && isModerator && renderColumnModifiers()}
{openedColumnSettings && (
<ColumnSettings
id={id}
Expand All @@ -222,6 +222,8 @@ export const Column = ({id, name, color, visible, index}: ColumnProps) => {
index={index}
onClose={() => setOpenedColumnSettings(false)}
onNameEdit={() => setColumnNameMode("EDIT")}
setOpenColumnSet={setOpenedColumnSettings}
closeColumnSettings={() => setOpenedColumnSettings(false)}
/>
)}
</div>
Expand Down
109 changes: 3 additions & 106 deletions src/components/Column/ColumnSettings.scss
laila-rin marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,108 +1,5 @@
@import "src/constants/style";
@import "constants/style";

.column__header-menu-dropdown {
position: absolute;
right: 0;
top: 75%;
width: 180px;
background-color: $gray--000;
border-radius: 8px;
box-shadow:
0 4px 6px -1px rgb(0 0 0 / 0.1),
0 2px 4px -2px rgb(0 0 0 / 0.1);
z-index: 150;
}

.column__header-menu-dropdown > ul {
list-style: none;
padding: $spacing--xs 0;
margin: 0;
}

.column__header-menu-dropdown > ul > li {
height: 32px;
padding: 0 $spacing--sm;
background-color: $gray--000;

&:hover {
filter: $darken--slightly;
}

&:focus-within {
background-color: $gray--200;
}
}

.column__header-menu-dropdown > ul > li > button {
cursor: pointer;
border: 0;
outline: none;
background-color: transparent;
padding: 0;
margin: 0;
height: 100%;
width: 100%;
display: flex;
align-items: center;
gap: 10px;
font-size: $text-size--small;
}

.column__header-menu-dropdown > ul > li > button > svg {
height: $icon--large;
width: $icon--large;
}

.column__header-menu-dropdown > ul > li:last-of-type {
height: auto;
padding: $spacing--xs $spacing--base;
display: flex;
justify-content: space-between;
}

.column__header-menu-dropdown > ul > li:last-child > button {
height: 18px;
width: 18px;
border-radius: 4px;
background-color: var(--accent-color--light);
transition: all 0.08s ease-out;

&:hover {
transform: scale(1.1);
}

&:focus-visible {
box-shadow: 0 0 0 2px $navy--300;
}
}

// Hacky way to not show delete column button if it's the last column
.column:only-of-type .column__header-menu-dropdown > ul > li:nth-child(5) {
display: none;
}

[theme="dark"] {
.column__header-menu-dropdown {
background-color: $navy--500;
}

.column__header-menu-dropdown > ul > li {
background-color: $navy--500;

&:hover {
filter: $brighten--slightly;
}

&:focus-within {
background-color: $navy--400;
}
}

.column__header-menu-dropdown > ul > li > button {
color: $gray--000;
}

.column__header-menu-dropdown > ul > li:last-child > button:focus-visible {
box-shadow: 0 0 0 2px $gray--000;
}
.column-settings {
z-index: $menu-z-index;
}
Loading
Loading