Skip to content

Commit eef5f0b

Browse files
committed
refactor(components/top-bar): gecut top bar
1 parent 88f973c commit eef5f0b

File tree

4 files changed

+60
-24
lines changed

4 files changed

+60
-24
lines changed
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
import {classMap} from 'lit/directives/class-map.js';
21
import {html, nothing} from 'lit/html.js';
32

43
import {endIconListTemplate} from './_end-icon-list.js';
54
import {gecutIconButton} from '../icon-button/icon-button.js';
65

76
import type {TopBarContent} from './_type.js';
87

9-
export const gecutCenterTopBar = (content: TopBarContent, scroll = false) =>
10-
html`<header
11-
class="z-sticky flex h-16 shrink-0 grow-0 select-none items-center
12-
bg-surface [&.scroll]:bg-surfaceContainer ${classMap({scroll})}"
13-
>
14-
${content.startIcon ? gecutIconButton(content.startIcon) : nothing}
8+
export const gecutCenterTopBar = (content: TopBarContent) => html`
9+
<header class="gecut-top-bar center">
10+
<div class="gecut-top-bar-box">
11+
<div>${content.startIcon ? gecutIconButton(content.startIcon) : nothing}</div>
1512
16-
<div class="lead grow overflow-clip whitespace-nowrap px-1 text-center text-titleLarge text-onSurface">
17-
${content.title}
18-
</div>
13+
<div class="gecut-top-bar-title">
14+
<h1>${content.title}</h1>
15+
</div>
1916
20-
${endIconListTemplate(content.endIconList)}
21-
</header>`;
17+
<div>${endIconListTemplate(content.endIconList)}</div>
18+
</div>
19+
</header>
20+
`;
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
import {classMap} from 'lit/directives/class-map.js';
21
import {html, nothing} from 'lit/html.js';
32

43
import {endIconListTemplate} from './_end-icon-list.js';
54
import {gecutIconButton} from '../icon-button/icon-button.js';
65

76
import type {TopBarContent} from './_type.js';
87

9-
export const gecutSmallTopBar = (content: TopBarContent, scroll = false) =>
10-
html`<header
11-
class="z-sticky flex h-16 shrink-0 grow-0 select-none items-center
12-
bg-surface [&.scroll]:bg-surfaceContainer ${classMap({scroll})}"
13-
>
14-
${content.startIcon ? gecutIconButton(content.startIcon) : nothing}
8+
export const gecutSmallTopBar = (content: TopBarContent) => html`
9+
<header class="gecut-top-bar small">
10+
<div class="gecut-top-bar-box">
11+
<div>${content.startIcon ? gecutIconButton(content.startIcon) : nothing}</div>
1512
16-
<div class="lead me-auto overflow-clip whitespace-nowrap px-1 text-center text-titleLarge text-onSurface">
17-
${content.title}
18-
</div>
13+
<div class="gecut-top-bar-title">
14+
<h1>${content.title}</h1>
15+
</div>
1916
20-
${endIconListTemplate(content.endIconList)}
21-
</header>`;
17+
<div>${endIconListTemplate(content.endIconList)}</div>
18+
</div>
19+
</header>
20+
`;

packages/styles/src/components/components.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
@import './item.css';
66
@import './list.css';
77
@import './snack-bar.css';
8+
@import './top-bar.css';
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@layer components {
2+
.gecut-top-bar {
3+
&-box {
4+
& > div {
5+
@apply flex items-center justify-center;
6+
}
7+
8+
@apply max-w-screen-sm mx-auto flex px-1 py-2 w-full h-full *:h-auto relative;
9+
}
10+
11+
&-title {
12+
h1 {
13+
@apply w-full;
14+
}
15+
16+
@apply text-titleLarge text-primary grow px-2;
17+
}
18+
19+
&.center {
20+
.gecut-top-bar-title > h1 {
21+
@apply text-center;
22+
}
23+
}
24+
25+
&.small {
26+
.gecut-top-bar-title > h1 {
27+
@apply text-start;
28+
}
29+
}
30+
31+
.gecut-button {
32+
@apply px-4;
33+
}
34+
35+
@apply fixed top-0 inset-x-0 bg-surfaceContainer translucent flex flex-col;
36+
}
37+
}

0 commit comments

Comments
 (0)