Skip to content

Commit 437b9e7

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 Co-Authored-By: heyMP <[email protected]>
1 parent 7a025b7 commit 437b9e7

30 files changed

+3055
-4583
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+
});

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

Lines changed: 10 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,9 @@ html {
33
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 {
1911
/* Just in here for sanity knowing outside styles can't leak in */
@@ -37,60 +29,17 @@ a.pfe-jump-links-nav__item {
3729
}
3830

3931
#jumplinks9 {
40-
--pfe-jump-links--offset: 60px;
32+
--pfe-jump-links--offset: 0;
4133
@media(min-width: 992px) {
4234
--pfe-jump-links--offset: 130px;
4335
}
4436
}
4537

4638

47-
/* SET OFFSET */
48-
/* .special {
49-
--pfe-jump-links-panel--offset: 100;
50-
--pfe-jump-links__nav--offset: 100px;
39+
#jumplinks1000 {
40+
--pfe-jump-links--BackgroundColor: #fff;
41+
--pfe-jump-links--BorderColor: #e00;
42+
--pfe-jump-links--FontSize: 16px;
43+
--pfe-jump-links__heading--FontSize: 12px;
44+
--pfe-jump-links__nav--Padding: 30px;
5145
}
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-
*/
63-
64-
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-

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