Skip to content

Commit 891053e

Browse files
alesiahilvkozio
andauthored
fix(toolbar): remove group names and divider (#1217)
Co-authored-by: VK <112831093+vkozio@users.noreply.github.com>
1 parent 8fe764d commit 891053e

File tree

2 files changed

+14
-119
lines changed

2 files changed

+14
-119
lines changed
Lines changed: 2 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,19 @@
11
.toolbarContent {
22
padding: var(--unit);
33
min-height: inherit;
4-
display: flex;
5-
flex-flow: row nowrap;
6-
gap: var(--unit);
7-
overflow-x: auto;
8-
}
9-
10-
.sectionDivider {
11-
width: 1px;
12-
min-height: 100%;
13-
background-color: var(--faint-weak);
14-
flex-shrink: 0;
15-
}
16-
17-
.sectionLabel {
18-
text-align: center;
19-
color: var(--faint-strong-up, #848c94);
20-
21-
font: var(--font-xs);
22-
font-style: normal;
23-
font-weight: 400;
24-
line-height: 16px; /* 133.333% */
25-
letter-spacing: 0.038px;
26-
}
27-
28-
.section {
29-
display: flex;
30-
flex-flow: column nowrap;
31-
gap: var(--unit);
32-
transition:
33-
max-height 0.3s ease,
34-
opacity 0.3s ease;
35-
}
36-
37-
.sectionArrow {
38-
display: none;
39-
rotate: 180deg;
40-
margin-left: var(--unit);
41-
}
42-
43-
.sectionToggleCheckbox {
44-
display: none;
45-
}
46-
47-
.sectionContent {
48-
flex: 1;
494
display: grid;
505
grid-template-rows: repeat(6, auto);
516
grid-auto-flow: column;
527
gap: var(--half-unit);
8+
overflow-x: auto;
539
}
5410

5511
@media screen and (max-width: 960px) {
5612
.toolbarContent {
57-
flex-direction: column;
58-
gap: calc(var(--unit) * 3);
59-
padding: calc(var(--unit) * 3) var(--double-unit);
60-
}
61-
62-
.section {
63-
gap: calc(var(--unit) * 3);
64-
}
65-
66-
.sectionLabel {
67-
order: -1; /* Move the label to come before the content */
68-
text-align: start;
69-
line-height: 18px;
70-
font-size: 16px;
71-
display: flex;
72-
align-items: center;
73-
}
74-
75-
.sectionArrow {
76-
display: inline;
77-
}
78-
79-
.sectionDivider {
80-
min-height: 1px;
81-
width: 100%;
82-
}
83-
84-
.sectionContent {
8513
display: flex;
8614
flex-wrap: wrap;
8715
align-items: flex-start;
8816
gap: 12px;
89-
}
90-
91-
.section:has(.sectionToggleCheckbox:checked) .sectionContent {
92-
max-height: 0;
93-
opacity: 0;
94-
display: none;
95-
}
96-
97-
.section:has(.sectionToggleCheckbox:not(:checked)) .sectionContent {
98-
max-height: 500px;
99-
opacity: 1;
100-
}
101-
102-
.sectionToggleCheckbox:not(:checked) ~ .sectionArrow {
103-
rotate: 0deg;
17+
padding: calc(var(--unit) * 3) var(--double-unit);
10418
}
10519
}

src/features/toolbar/components/ToolbarContent/ToolbarContent.tsx

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,26 @@
1-
import { Fragment, useRef } from 'react';
2-
import { ChevronDown16 } from '@konturio/default-icons';
1+
import { useRef } from 'react';
32
import { useToolbarContent } from '~features/toolbar/hooks/use-toolbar-content';
43
import { useWheelHorizontalScroll } from '~utils/hooks/useWheelHorizontalScroll';
54
import { ToolbarControl } from '../ToolbarControl/ToolbarControl';
65
import { ToolbarButton } from '../ToolbarButton/ToolbarButton';
76
import s from './ToolbarContent.module.css';
87

98
export const ToolbarContent = () => {
10-
const toolbarContent = useToolbarContent();
9+
const toolbarContent = useToolbarContent().flatMap(({ buttons }) => buttons);
1110
const scrollRef = useRef<HTMLDivElement>(null);
1211
useWheelHorizontalScroll(scrollRef);
1312

1413
return (
15-
<div className={s.toolbarContent} ref={scrollRef}>
16-
{toolbarContent.map(({ sectionName, buttons }, index) => (
17-
<Fragment key={sectionName}>
18-
{index > 0 && <div className={s.sectionDivider} />}
19-
{
20-
<div className={s.section}>
21-
<div className={s.sectionContent}>
22-
{buttons.map(({ id, settings, stateAtom }) => {
23-
return (
24-
<ToolbarControl
25-
id={id}
26-
data-testid={id}
27-
key={id}
28-
settings={settings}
29-
stateAtom={stateAtom}
30-
controlComponent={ToolbarButton}
31-
/>
32-
);
33-
})}
34-
</div>
35-
<label className={s.sectionLabel}>
36-
<input type="checkbox" className={s.sectionToggleCheckbox} />
37-
{sectionName}
38-
<ChevronDown16 className={s.sectionArrow} />
39-
</label>
40-
</div>
41-
}
42-
</Fragment>
14+
<div className={s.toolbarContent}>
15+
{toolbarContent.map(({ id, settings, stateAtom }) => (
16+
<ToolbarControl
17+
id={id}
18+
data-testid={id}
19+
key={id}
20+
settings={settings}
21+
stateAtom={stateAtom}
22+
controlComponent={ToolbarButton}
23+
/>
4324
))}
4425
</div>
4526
);

0 commit comments

Comments
 (0)