Skip to content

Commit 48fc937

Browse files
bennypowersheyMP
andcommitted
feat(jump-links)!: migrate pfe-jump-links to lit
fix(jump-links): doc updates and fixes (#1829) * chore: remove old demo sticky nav * fix: enable offset to be set to zero * chore: remove old demo panel offset * fix: accent-bar mixin wasn't setting proper width * feat: support multiple nested scroll containers * chore: update docs * remove duplicate background-color property. test(pfe-jump-links): e2e tests feat(jump-links): migrate events to ComposedEvent fix(jump-links): type of ActiveItemEvent param feat: changed event names/types for change, stuck & content-change. Updated tests style(jump-links): lint test(jump-links): update demo file test(pfe-jump-links): e2e tests with page object model test(pfe-jump-links): build demo with optional shadowroot docs(pfe-jump-links): rearrange docs urls Co-Authored-By: Michael Potter <[email protected]>
1 parent c68c73b commit 48fc937

29 files changed

+3068
-4599
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { pfeCustomElementsManifestConfig } from '@patternfly/pfe-tools/custom-elements-manifest.js';
2+
3+
export default pfeCustomElementsManifestConfig({
4+
globs: ['pfe-*.ts'],
5+
});
Lines changed: 27 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,46 @@
1-
html {
2-
background: #eee;
3-
scroll-behavior: smooth;
1+
:host {
2+
background: #eee;
3+
scroll-behavior: smooth;
44
}
55

6-
/* #nav-vars-set { */
7-
/* --pfe-navigation--Height--actual: 55px; */
8-
/* --pfe-jump-links--nav-height: 62px; */
9-
/* --pfe-jump-links-panel__section--spacer: 117px;
10-
--pfe-jump-links-panel--offset: 55px; */
11-
12-
/* For testing */
13-
/* --pfe-jump-links-panel--offset: 120px; */
14-
/* --pfe-jump-links-panel--offset: 20vw; */
15-
/* --pfe-jump-links-panel--offset: 80; */
16-
/* } */
6+
:host {
7+
--pfe-navigation--Height--actual: 0 !important;
8+
}
179

1810
a.pfe-jump-links-nav__item {
19-
/* Just in here for sanity knowing outside styles can't leak in */
20-
color: orange !important;
11+
/* Just in here for sanity knowing outside styles can't leak in */
12+
color: orange !important;
2113
}
2214

2315
.sticky {
24-
position: sticky;
25-
top: 0;
26-
z-index: 80;
16+
position: sticky;
17+
top: 0;
18+
z-index: 80;
2719
}
2820

2921
.sticky pfe-jump-links-nav {
30-
top: 0 !important;
31-
}
32-
33-
@media(min-width: 992px) {
34-
.sticky {
35-
top: 150px !important;
36-
}
22+
top: 0 !important;
3723
}
3824

3925
#jumplinks9 {
40-
--pfe-jump-links--offset: 60px;
41-
@media(min-width: 992px) {
42-
--pfe-jump-links--offset: 130px;
43-
}
26+
--pfe-jump-links--offset: 0;
4427
}
4528

4629

47-
/* SET OFFSET */
48-
/* .special {
49-
--pfe-jump-links-panel--offset: 100;
50-
--pfe-jump-links__nav--offset: 100px;
30+
#jumplinks1000 {
31+
--pfe-jump-links--BackgroundColor: #fff;
32+
--pfe-jump-links--BorderColor: #e00;
33+
--pfe-jump-links--FontSize: 16px;
34+
--pfe-jump-links__heading--FontSize: 12px;
35+
--pfe-jump-links__nav--Padding: 30px;
5136
}
52-
@media(max-width: 992px) {
53-
.special{
54-
--pfe-jump-links-panel--offset: 60px;
55-
--pfe-jump-links__nav--offset: 60px;
56-
}
57-
} */
58-
59-
/*
60-
* Fixing the issue where the headers are under the stick nav
61-
* https://stackoverflow.com/questions/4086107/fixed-page-header-overlaps-in-page-anchors
62-
*/
6337

38+
@media(min-width: 992px) {
39+
#jumplinks9 {
40+
--pfe-jump-links--offset: 130px;
41+
}
6442

65-
/* FAKE NAV BAR */
66-
/* #navbar {
67-
position: fixed;
68-
top: 0;
69-
width: 100%;
70-
height: var(--pfe-navigation--Height--actual);
71-
z-index: 9;
72-
padding-top: 0;
73-
} */
74-
75-
/* #navbar a {
76-
float: left;
77-
display: block;
78-
color: #f2f2f2;
79-
text-align: center;
80-
padding: 14px 16px;
81-
text-decoration: none;
82-
font-size: 17px;
83-
} */
84-
85-
/*
86-
.pfe-jump-links__section--spacer {
87-
content: '';
88-
display: block;
89-
position: relative;
90-
width: 0;
91-
margin-top: -64px;
92-
height: 64px;
93-
margin-top: calc( -1 * var(--pfe-jump-links-panel__section--spacer) );
94-
height: var(--pfe-jump-links-panel__section--spacer);
95-
} */
96-
43+
.sticky {
44+
top: 150px !important;
45+
}
46+
}

elements/pfe-jump-links/demo/index.html

Lines changed: 0 additions & 1290 deletions
This file was deleted.

elements/pfe-jump-links/demo/pfe-jump-links.html

Lines changed: 1226 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import '@patternfly/pfe-band';
2+
import '@patternfly/pfe-jump-links';
3+
4+
const root = document.querySelector('[data-demo="pfe-jump-links"]')?.shadowRoot ?? document;
5+
6+
import { installRouter } from 'pwa-helpers/router.js';
7+
8+
/**
9+
* scroll to element with id in the URL hash.
10+
* @this {HTMLElement}
11+
*/
12+
async function route(location = window.location, event) {
13+
event.preventDefault();
14+
event.stopPropagating();
15+
if (location.hash) {
16+
root?.querySelector(location.hash)?.scrollIntoView({ behavior: 'smooth' });
17+
}
18+
}
19+
20+
installRouter(route);
21+
22+
route();

elements/pfe-jump-links/demo/pfe-jump-links.story.js

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)