Skip to content

Commit cfc5913

Browse files
brianferryzeroedineyevana
authored
docs: updating dev server header to match live site (#2424)
* feat: adding header to the dev server, adding css and logoUrl * feat(tools): multiple repo host icons * chore(tools): add changeset * fix(tools): use blank string instead of null * Update tools/pfe-tools/dev-server/demo.css Co-authored-by: Ivana Rodriguez <[email protected]> * Update tools/pfe-tools/dev-server/index.html Co-authored-by: Ivana Rodriguez <[email protected]> * fix: removing repoHost from config, pulling value from sourceControlURLPrefix --------- Co-authored-by: Steven Spriggs <[email protected]> Co-authored-by: Ivana Rodriguez <[email protected]>
1 parent e45f5eb commit cfc5913

File tree

4 files changed

+138
-82
lines changed

4 files changed

+138
-82
lines changed

.changeset/weak-planes-grab.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@patternfly/pfe-tools": patch
3+
---
4+
5+
`pfe-tools`:
6+
- Updated dev server header styles to match look and feel of 11ty documentation site
7+
- Added `repoHost` to `PfeConfig` which enables customizing the dev server repository host name and icon

tools/pfe-tools/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ export interface PfeConfig {
3434

3535
const SITE_DEFAULTS: Required<SiteOptions> = {
3636
description: 'PatternFly Elements: A set of community-created web components based on PatternFly design.',
37-
favicon: '/brand/logo/svg/pfe-icon-blue.svg',
38-
logoUrl: '/brand/logo/svg/pfe-icon-white-shaded.svg',
37+
favicon: '/docs/images/logo/pfe-icon-blue.svg',
38+
logoUrl: '/docs/images/pfe-logo-inverse-white.svg',
3939
stylesheets: [],
40-
title: 'PatternFly Elements',
40+
title: 'PatternFly Elements'
4141
};
4242

4343
const DEFAULT_CONFIG: PfeConfig = {

tools/pfe-tools/dev-server/demo.css

Lines changed: 75 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ html, body {
3030
body {
3131
min-height: 100%;
3232
display: grid;
33-
grid-template-rows: var(--pf-demo-header-height, 60px) auto;
33+
grid-template-rows: var(--pf-demo-header-height, 4.375rem) auto;
3434
grid-template-columns: 100vw;
3535
grid-template-areas:
3636
'head'
@@ -44,6 +44,64 @@ body.menu-open {
4444
'menu body';
4545
}
4646

47+
#main-header {
48+
grid-area: head;
49+
display: block;
50+
}
51+
52+
.logo-bar {
53+
display: flex;
54+
height: var(--pf-demo-header-height, 4.375rem);
55+
align-items: center;
56+
gap: 1rem;
57+
padding-inline-start: var(--pf-c-masthead--PaddingLeft, var(--pf-c-masthead--inset, 24px));
58+
padding-inline-end: var(--pf-c-masthead--PaddingRight, var(--pf-c-masthead--inset, 24px));
59+
padding-block: 8px;
60+
color: white;
61+
background: var(--pf-theme--color--accent, #0066cc);
62+
}
63+
64+
.logo-bar > a {
65+
display: flex;
66+
align-items: center;
67+
color: white;
68+
text-decoration: none;
69+
font-size: 1.25rem;
70+
font-weight: bold;
71+
height: 100%;
72+
}
73+
74+
.logo-bar > a img {
75+
height: 100%;
76+
}
77+
78+
.logo-bar svg {
79+
height: 100%;
80+
}
81+
82+
.logo-bar #hamburger {
83+
--pf-c-button--m-plain--Color: #fff;
84+
--pf-c-button--m-plain--active--Color: #fff;
85+
--pf-c-button--m-plain--focus--Color: #fff;
86+
--pf-c-button--m-plain--hover--Color: #fff;
87+
}
88+
89+
#source-control {
90+
display: flex;
91+
gap: 0.5rem;
92+
font-size: 1rem;
93+
font-weight: 400;
94+
margin-inline-start: auto;
95+
}
96+
97+
#source-control:hover {
98+
text-decoration: underline;
99+
}
100+
101+
#source-control svg {
102+
height: var( --pf-global--icon--FontSize--lg, 1.5rem);
103+
}
104+
47105
#components {
48106
display: grid;
49107
padding: 1em;
@@ -77,60 +135,24 @@ body.menu-open {
77135
grid-template-columns: 100vw 0;
78136
}
79137

138+
#source-control span {
139+
/* Hide the text on small screens */
140+
position: absolute;
141+
width: 1px;
142+
height: 1px;
143+
padding: 0;
144+
margin: -1px;
145+
overflow: hidden;
146+
clip: rect(0, 0, 0, 0);
147+
white-space: nowrap;
148+
border: 0;
149+
}
150+
80151
#sidebar {
81152
width: 100%;
82153
}
83154
}
84155

85-
#main-header {
86-
--pf-navigation--Height--actual: 60px;
87-
grid-area: head;
88-
background: var(--pf-theme--color--surface--accent, #004080);
89-
color: white;
90-
padding: 1em;
91-
display: flex;
92-
align-items: center;
93-
justify-content: space-between;
94-
position: fixed;
95-
top: 0;
96-
left: 0;
97-
right: 0;
98-
display: flex;
99-
align-items: center;
100-
height: 3.75rem;
101-
padding: var(--pf-theme--container-spacer, 16px);
102-
color: white;
103-
background: var(--pf-theme--color--surface--accent, #004080);
104-
z-index: 200;
105-
}
106-
107-
#main-header a {
108-
display: flex;
109-
align-items: center;
110-
color: white;
111-
text-decoration: none;
112-
font-size: 1.25rem;
113-
font-weight: bold;
114-
/* margin-left: calc(1.5rem + 16px); */
115-
}
116-
117-
#main-header a:visited {
118-
color: white;
119-
text-decoration: none;
120-
}
121-
122-
#main-header #hamburger + a {
123-
margin-inline-end: auto;
124-
}
125-
126-
#main-header a img {
127-
display: none;
128-
}
129-
130-
#main-header svg {
131-
height: 40px;
132-
}
133-
134156
#sidebar {
135157
grid-area: menu;
136158
}
@@ -141,11 +163,12 @@ body.menu-open {
141163

142164
#nav {
143165
width: 100%;
144-
height: calc(100vh - 3.75rem);
166+
height: calc(100vh - var(--pf-demo-header-height, 4.375rem));
145167
overflow-y: auto;
146168
color: #151515;
147169
background: #fff;
148170
border-right: .0625rem solid #d2d2d2;
171+
padding-block-start: 1rem;
149172
}
150173

151174
#nav ul {
@@ -226,7 +249,7 @@ body.menu-open {
226249
grid-area: body;
227250
position: fixed;
228251
min-width: 50vw;
229-
top: 64px;
252+
top: var(--pf-demo-header-height, 4.375rem);
230253
z-index: 2;
231254
}
232255

@@ -575,16 +598,4 @@ footer ul {
575598
position: relative;
576599
top: 2rem;
577600
}
578-
579-
#main-header a {
580-
margin-left: 16px;
581-
}
582-
583-
#main-header a img {
584-
display: inline-block;
585-
height: 3.75rem;
586-
position: relative;
587-
left: -1rem;
588-
margin-right: -1rem;
589-
}
590601
}

tools/pfe-tools/dev-server/index.html

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44
{% else %}
55
{% set title = options.site.title %}
66
{% endif %}
7+
8+
{% if options.sourceControlURLPrefix %}
9+
{% if options.sourceControlURLPrefix.toLowerCase().includes('github') %}
10+
{% set repoHost = 'GitHub' %}
11+
{% elseif options.sourceControlURLPrefix.toLowerCase().includes('bitbucket') %}
12+
{% set repoHost = 'BitBucket' %}
13+
{% elseif options.sourceControlURLPrefix.toLowerCase().includes('gitlab') %}
14+
{% set repoHost = 'GitLab' %}
15+
{% else %}
16+
{% set repoHost = '' %}
17+
{% endif %}
18+
{% endif %}
719
<!DOCTYPE html>
820
<html lang="en" dir="ltr" unresolved>
921

@@ -24,28 +36,54 @@
2436
import 'element-internals-polyfill';
2537
import '@patternfly/elements/pf-button/pf-button.js';
2638
import '@patternfly/elements/pf-card/pf-card.js';
39+
import '@patternfly/elements/pf-icon/pf-icon.js';
2740
import '@patternfly/pfe-tools/dev-server/demo.js';
2841
</script>
2942
</head>
3043

3144
<body class="menu-open">
3245
<header id="main-header">
33-
<pf-button id="hamburger"
34-
plain
35-
aria-controls="sidebar"
36-
style="--pf-c-button--m-plain--Color:white"
37-
label="Expand Main Navigation">
38-
<pf-icon icon="bars"></pf-icon>
46+
<div class="logo-bar">
47+
<pf-button
48+
id="hamburger"
49+
plain
50+
aria-controls="sidebar"
51+
label="Expand Main Navigation">
52+
<pf-icon icon="bars" size="lg"></pf-icon>
3953
</pf-button>
40-
<a href="/"><img src="{{ options.site.logoUrl }}" alt="">{{ title }}</a>
41-
<a id="github-link" href="{{ options.sourceControlURLPrefix.replace('tree/main/', '') }}{{ ('tree/main' + manifest.path.replace(context.cwd, '').replace('/custom-elements.json', '/')) if manifest else ''}}">
42-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
43-
<title>GitHub</title>
44-
<!-- Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
45-
<path fill="currentColor"
46-
d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" />
47-
</svg>
48-
</a>
54+
<a href="/" aria-label="{{title}} Home">
55+
<img src="{{ options.site.logoUrl }}" alt="{{title}}">
56+
</a>
57+
<a href="{{ options.sourceControlURLPrefix.replace('tree/main/', '') }}{{ ('tree/main' + manifest.path.replace(context.cwd, '').replace('/custom-elements.json', '/')) if manifest else ''}}" id="source-control">
58+
59+
{% if options.sourceControlURLPrefix %}<span>Contribute on {{ repoHost }}</span>{% endif %}
60+
{% if repoHost === 'GitHub' %}
61+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
62+
<!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
63+
<title>GitHub</title>
64+
<path fill="currentColor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/>
65+
</svg>
66+
{% elseif repoHost === 'GitLab' %}
67+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
68+
<title>GitLab</title>
69+
<!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
70+
<path fill="currentColor" d="M503.5 204.6L502.8 202.8L433.1 21.02C431.7 17.45 429.2 14.43 425.9 12.38C423.5 10.83 420.8 9.865 417.9 9.57C415 9.275 412.2 9.653 409.5 10.68C406.8 11.7 404.4 13.34 402.4 15.46C400.5 17.58 399.1 20.13 398.3 22.9L351.3 166.9H160.8L113.7 22.9C112.9 20.13 111.5 17.59 109.6 15.47C107.6 13.35 105.2 11.72 102.5 10.7C99.86 9.675 96.98 9.295 94.12 9.587C91.26 9.878 88.51 10.83 86.08 12.38C82.84 14.43 80.33 17.45 78.92 21.02L9.267 202.8L8.543 204.6C-1.484 230.8-2.72 259.6 5.023 286.6C12.77 313.5 29.07 337.3 51.47 354.2L51.74 354.4L52.33 354.8L158.3 434.3L210.9 474L242.9 498.2C246.6 500.1 251.2 502.5 255.9 502.5C260.6 502.5 265.2 500.1 268.9 498.2L300.9 474L353.5 434.3L460.2 354.4L460.5 354.1C482.9 337.2 499.2 313.5 506.1 286.6C514.7 259.6 513.5 230.8 503.5 204.6z"/>
71+
</svg>
72+
{% elseif repoHost === 'BitBucket' %}
73+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
74+
<title>BitBucket</title>
75+
<!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
76+
<path fill="currentColor" d="M22.2 32A16 16 0 0 0 6 47.8a26.35 26.35 0 0 0 .2 2.8l67.9 412.1a21.77 21.77 0 0 0 21.3 18.2h325.7a16 16 0 0 0 16-13.4L505 50.7a16 16 0 0 0-13.2-18.3 24.58 24.58 0 0 0-2.8-.2L22.2 32zm285.9 297.8h-104l-28.1-147h157.3l-25.2 147z"/>
77+
</svg>
78+
{% elseif repoHost | trim === '' %}
79+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
80+
<title>Git Repository</title>
81+
!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. -->
82+
<path fill="currentColor" d="M439.55 236.05L244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/>
83+
</svg>
84+
{% endif %}
85+
</a>
86+
</div>
4987
</header>
5088
<aside id="sidebar" aria-expanded="true">
5189
<nav id="nav" aria-label="Main Navigation">

0 commit comments

Comments
 (0)