Skip to content

Commit ed82797

Browse files
committed
Improve the header component
1 parent 74db939 commit ed82797

File tree

4 files changed

+57
-20
lines changed

4 files changed

+57
-20
lines changed

docs/pages/components/header.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,30 @@ layout: component
66
---
77

88
```html:preview
9-
<zn-header></zn-header>
9+
10+
<zn-header caption="John Jones"
11+
description="This is the Description of the header"
12+
previous-path="#"
13+
breadcrumb="[{&quot;path&quot;:&quot;#&quot;,&quot;title&quot;:&quot;Dashboard&quot;},{&quot;path&quot;:&quot;#&quot;,&quot;title&quot;:&quot;Another&quot;}]"
14+
navigation="[{&quot;path&quot;:&quot;#&quot;,&quot;title&quot;:&quot;Dashboard&quot;},{&quot;path&quot;:&quot;#&quot;,&quot;title&quot;:&quot;Another&quot;}]">
15+
<zn-icon round src="test1@example.com" size="36"></zn-icon>
16+
</zn-header>
1017
```
1118

1219
## Examples
1320

14-
### First Example
21+
### Simple Header
22+
23+
```html:preview
1524
16-
TODO
25+
<zn-header caption="John Jones"></zn-header>
26+
```
1727

18-
### Second Example
28+
### Simple Header with description
1929

20-
TODO
30+
```html:preview
31+
32+
<zn-header caption="John Jones" description="This is the description of the header"></zn-header>
33+
```
2134

2235

src/components/header/header.component.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,18 @@ export default class ZnHeader extends ZincElement {
160160
${breadcrumb} <!--- Maybe make this into a component -->
161161
</div>` : null}
162162
163+
${hasPreviousPath ? html`
164+
<a href="${this.previousPath}" class="caption__back"
165+
data-target="${this.previousTarget ? this.previousTarget : ''}">
166+
<zn-button size="content" icon="arrow_back" icon-size="24" color="transparent"></zn-buttonicon>
167+
</a>` : null}
168+
163169
${hasDefaultSlot ? html`
164170
<div class="actions">
165171
<slot></slot>
166172
</div>` : ''}
167173
168174
<div class="caption">
169-
${hasPreviousPath ? html`
170-
<a href="${this.previousPath}" class="caption__back"
171-
data-target="${this.previousTarget ? this.previousTarget : ''}">
172-
<zn-icon src="arrow_back"></zn-icon>
173-
</a>` : null}
174175
<div class="header__left">
175176
<span class="header__caption" part="header-caption">${this.caption}</span>
176177
<span class="header__description">${this.description}</span>

src/components/header/header.scss

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99

1010
// This isn't correct fix this also
1111
.caption {
12-
padding: var(--zn-spacing-small) 0;
12+
//padding: var(--zn-spacing-small) 0;
1313
}
1414

1515
&__caption {
1616
font-weight: var(--zn-font-weight-bold);
1717
font-size: var(--zn-font-size-medium);
1818
color: rgba(var(--zn-text-panel-title), 100%);
1919
margin: 0;
20-
line-height: 35px;
2120
}
2221

2322
&--has-breadcrumb {
@@ -34,6 +33,16 @@
3433
}
3534
}
3635

36+
.caption__back {
37+
display: flex;
38+
justify-content: center;
39+
align-items: center;
40+
color: inherit;
41+
}
42+
43+
.content {
44+
padding: var(--zn-spacing-small) 0;
45+
}
3746

3847
:host([transparent]) > div {
3948
background-color: transparent;
@@ -99,6 +108,18 @@
99108
padding-right: var(--zn-spacing-large);
100109
}
101110

111+
.header__left {
112+
display: flex;
113+
justify-content: center;
114+
flex-direction: column;
115+
gap: var(--zn-spacing-2x-small);
116+
}
117+
118+
.header__description {
119+
display: contents;
120+
font-size: var(--zn-font-size-small);
121+
}
122+
102123
.navless {
103124
min-height: 10px;
104125
}
@@ -109,12 +130,18 @@
109130

110131
.breadcrumb {
111132
flex-basis: 100%;
112-
font-size: 12px;
113-
line-height: 12px;
133+
font-size: var(--zn-font-size-x-small);
134+
font-weight: var(--zn-font-weight-semibold);
135+
color: rgb(var(--zn-primary));
136+
137+
display: flex;
138+
align-items: center;
139+
gap: var(--zn-spacing-2x-small);
114140

115141
a {
116142
font-size: 0.875rem;
117-
color: inherit;
143+
color: rgb(var(--zn-text));
144+
font-weight: var(--zn-font-weight-normal);
118145
text-decoration: inherit;
119146

120147
&:hover {
@@ -123,10 +150,6 @@
123150
}
124151
}
125152

126-
.breadcrumb:not(:empty) {
127-
padding-top: 10px;
128-
}
129-
130153
.caption {
131154
flex-grow: 1;
132155
display: flex;
@@ -152,7 +175,6 @@
152175
h1 {
153176
flex-grow: 1;
154177
font-size: 18px;
155-
line-height: 35px;
156178

157179
overflow: hidden;
158180
text-overflow: ellipsis;

src/components/navbar/navbar.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ ul {
164164

165165
&.active, &.zn-tb-active {
166166
color: rgb(var(--zn-primary));
167+
font-weight: var(--zn-font-weight-semibold);
167168
}
168169

169170
&.active::before, &.zn-tb-active::before {

0 commit comments

Comments
 (0)