Skip to content

Commit 274e35c

Browse files
castastrophekylebuch8
authored andcommitted
pfe-navigation component (#421)
* initial pfe-navigation changes * ch ch ch changes * initial pfe-navigation commit * Bring back the pfe-link-list component; updates to structure of navigation component * Revert "initial pfe-navigation commit" This reverts commit 0148e8b. * Getting navigation to a workabout/style-able place * Working on theming the navigation-items based on latest mock-ups * Make the navigation item with icons smaller text * Got icons working again; polishing states for navigation-items; cleaning up styles for mobile nav * Apply icons using variables * Adding styles for the mobile login and language switchers * Update navigation styles * Add sticky navigation setting and set up click outside to close * Updating cloning * Add overflow settings to tray region * Tweaks to overflow settings inside the navigation-item tray * Port the mobile login and language to shadowDOM * Updating variables to map more closely to the design system * Adjusting where JS is defined for Safari * Trying to get Safari to render correctly * Wrap mobile search in a container so it is easier to hide-show on mobile * Set up the resize to hide the menu when over 996px * Add path support for Safari and FF * Add back navigation-main for markup * Add a few more styles to the link-list component to match mock-ups * Replace Red Hat logo with generic placeholder * Remove unused this.slot declaration which was causing a slot attribute to be added to the wrapper * Updating styles via code review feedback with Kendall * Updates re: design feedback + fix bug with close item state * Fix the focus-within issue; remove selector, style on parent trigger element * Suppress the fallback link when upgraded * Shoring up support for direct links in the top-navigation * Add tests tot he demo page for dynamic content injectin * Working on fallback and improved styles for edge * Working on edge styles + add more information to the custom toggled event to make content switching easier * Edge is looking good; fallback styles * Edge style fixes * Adding more comments; wrapping elements in a warning if no light DOM * Add a closeAllNavigationItems function to more consistently handle the close items event in the main navigation element * Add a more dynamic way to render mobile-search content based on what's provided in the search slot using an attribute: pfe-navigation--mobile-search * Remove comments and fix background color styles * moving script tag inside closing body tag Also fixed backticks that IE11 doesn't care for. * moved the creation of PfeNavigation to top of the list I'm not really sure why this fixes things but order seems to matter here. I found the issue by getting rid of PfeNavigationItem and noticed that when I brought it back in, it created an error with the polyfill. Moving PfeNavigation ahead of it in the creation process seems to fix the issue. * Reworking accordion to work inside of the navigation component * Updating accordion styles to support hooks and additional properties * Revert accordion updates; moved to new branch: accordion-enhancements-updates * Update navigation to use bubble up events on click * Standardize on open and close custom events * Pull out link-list component; fix gulpfile configfactory variable; add back accordion mixins * Update examples and test files to remove link-list * Update height variable on sticky state for more graceful transition between sticky and non-sticky state * Code review feedback; remove console output * Update markup and imports for storybook instance * Tidy up navigation storybook, update markup with notes * Remove demo css for now * Working with the storybook settings; cleaning up the demo file; adjusting the padding on the nav styles for mobile; add navigation-item schema * Add light dom styles for tray region; use layouts instead of custom styles * Tweaking implementation of mobile nav for better IE11 experience * Add a direct link handler since link is disabled on upgrade * Fix overlay showing up when escape key is hit twice * Adding framework for light dom styles for link list * Fix the logic around which elements fire a close on screen resize * Push up updates to the styles based on code review feedback; updated pfe-radio to support fallback values * To prevent changes to existing styles, adjusting the radio function to check for a global variable, $USE-FALLBACK which defaults to false * Update schemas, add documentation to README * Push up fix for arrow on to show up on hover; pfe-icon prefixes added to stylesheet; pfe-sticky prefix in JS fixed * Update versions listed in the package.json for navigation * Add the pfe prefix to the icon in navigation stylesheet; updated package versions; add cursor styles to navigation item trigger element * Building the mobile navigation as light DOM; in a broken state but closer to finished now * pfe-navigation: Cleaning up desktop v. mobile view * Styles for the updated mobile navigation working in all screen sizes * Adjusting styles for the nested items, better chevron visibility * Updating the breakpoint approach, using attributes to toggle visibility * Resurrect mobile search fields * Letting breakpoints flow from the JS * Need to remove the consoles but working through open and close states * Add exception for hidden attribute on the menu item * Cleaning up trigger states in toggleHandler * Click events are all working at this point * Click events and keyboard navigation working * Add attributes so styles can be more efficient and clear * Add close icon * Ensure escape exits open items even if not in the active state list * Add todo note * removing bluebird dependency * Adjust events to generic toggle; add keymappings for older browsers * Move navItem collection for pfe-navigation-main to init function * Adjusting layout for mobile menu for better collapsibility * Update package to latest release; clean up event firing on nav * Refactor styles for better fallbacks, using slots not the shadow classes * Live code review feedback coding updates * Updating packages; debugging Edge errors * Update JS to support Edge upgrade; separate navigation files (add compilation task support in gulpfile) * Adjusting styles for edge compatibility * Navigation is working in IE11 - note there are debug messages in this commit * Use pfe-icon to fix IE11 upgrade bug * Adjusting styles for IE11 compatibility * Update package for navigation version * IE11 is upgrading! * Getting main navigation a little closer in IE11 * Pfe navigation light dom (#484) * pfe-navigation-light-dom added lightdom styles for desktop, still need to add mobile styles in shadowdom * pfe-navigation-light-dom added styles for desktop, still working through tablet * origin/pfe-navigation-light-dom added backup index.html file and updated styles to adjust branch testing bugs * pfe-navigation-light-dom added styles that addressed the rest of round 1 branch testing * pfe-navigation-light-dom updated styles for all sections to call in grid and be wrapped in generic column * pfe-navigation-light-dom added fallbacks for IE * pfe-navigation-light-dom cleaned up footer breakpoints so they're aligned when in columns * Merge code with pfe-nav base * pfe-navigation-light-dom updated class names to have prefix, added auto-flow grid for footer md breakpoint, added 3 columns for tray styles on md breakpoint * pfe-navigation-light-dom updated class naming to follow BEM syntax * Updating branch based on code review feedback * Set pfe-icon as a dependency of pfe-navigation-item * Add support for temp compilation with files defined in package.json * Style tweaks and adjustments based on branch testing; setting pfe-nav to private * Fix gulp build so that all assets are added to the temp directory and if no files array exists in the package.json, all those files are copied to the root * Remove themes from spandx config; remove tab focus trap from navigation * Update markup in the demo page, navigation readme * Fix storybook rendering by adjusting outside listener to allow nesting inside another web component * Clean up story; commenting out lightdom to debug styles * Improving on the edge experience * Tidying up edge experience * Simplify edge, looking good! * updating dynamically injected tray text * Remove console.log, remove outline on link * Add events to documentation * Stub out tests * Remove debug from nav-item; update example in test file; remove __last from template file * adding tests for pfe-navigation-main * test: adding more tests to pfe-navigation and pfe-navigation-item * [dev]: Updates to icon to support fallback text, no fallback text, and collapsing on fail * [dev]: Add TODO comment for icon hiding * fix: using the cdn for the polyfills We need this so it works with Netlify
1 parent 1546e11 commit 274e35c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+4400
-268
lines changed

.storybook/utils.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ const listProperties = (obj) =>
3737
print = true;
3838
}
3939

40-
// If printing is allowed, the value exists and is not null and is not a slot
40+
// If printing is allowed, the value exists and is not null
4141
if (
4242
print &&
4343
typeof v !== "undefined" &&
44-
(v !== null && v !== "null") &&
45-
p !== "slot"
44+
(v !== null && v !== "null")
4645
) {
4746
string += p;
4847
// If the value is a boolean and is false, or the value is not a string true
@@ -60,7 +59,7 @@ const listProperties = (obj) =>
6059
}
6160
}
6261
}
63-
return string.toLowerCase();
62+
return string;
6463
})
6564
.join(" ");
6665

elements/pfe-accordion/src/pfe-accordion.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $LOCAL: accordion;
77
position: relative;
88
overflow: hidden;
99
margin: 0;
10-
color: #{pfe-radio(color--text)};
10+
color: #{pfe-radio(color, text)};
1111
}
1212

1313
:host([on="dark"]) {

elements/pfe-icon/demo/index.html

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>PatternFly Element | pfe-icon Demo</title>
5+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
76

8-
<link rel="stylesheet" href="https://overpass-30e2.kxcdn.com/overpass.css" />
7+
<title>PatternFly Element | pfe-icon Demo</title>
98

109
<!-- uncomment the es5-adapter if you're using the umd version -->
11-
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.2.10/custom-elements-es5-adapter.js"></script>
12-
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.2.10/webcomponents-bundle.js"></script>
13-
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"></script>
14-
<script>require(['../pfe-icon.umd.js'])</script>
10+
<script src="/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
11+
<script src="/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
12+
<script src="/requirejs/require.js"></script>
13+
14+
<script>require([
15+
'../pfe-icon.umd.js',
16+
'../../pfe-card/pfe-card.umd.js'
17+
])</script>
1518

1619
<noscript>
1720
<link href="../../pfelement/pfelement-noscript.min.css" rel="stylesheet">
1821
</noscript>
1922

2023
<link href="../../pfelement/pfelement.min.css" rel="stylesheet">
24+
<link href="../../pfe-layouts/pfe-layouts.min.css" rel="stylesheet">
2125

2226
<style type="text/css" media="screen">
2327
body {
@@ -324,5 +328,25 @@ <h2>web icons</h2>
324328
<pfe-icon size="md" icon="web-user"></pfe-icon>
325329
<pfe-icon size="md" icon="web-youtube2"></pfe-icon>
326330
<pfe-icon size="md" icon="web-youtube"></pfe-icon>
331+
332+
<h2>Fail to load tests</h2>
333+
<div class="pfe-l-grid pfe-m-gutters pfe-m-all-6-on-xs pfe-m-all-3-col">
334+
<pfe-card pfe-color="light">
335+
<h3 slot="pfe-card--header">Fail with fallback text, no tags.</h3>
336+
<pfe-icon size="xl" icon="rh-foo-bar">Icon failed to load.</pfe-icon>
337+
</pfe-card>
338+
<pfe-card>
339+
<h3 slot="pfe-card--header">Fail with fallback text, p tag.</h3>
340+
<pfe-icon size="xl" icon="rh-foo-bar"><p>Icon failed to load.</p></pfe-icon>
341+
</pfe-card>
342+
<pfe-card>
343+
<h3 slot="pfe-card--header">Fail with preserve space on.</h3>
344+
<pfe-icon size="xl" icon="foo-bar" style="border: 1px solid hotpink;"></pfe-icon>
345+
</pfe-card>
346+
<pfe-card>
347+
<h3 slot="pfe-card--header">Fail with collapse blank space.</h3>
348+
<pfe-icon size="xl" icon="foo-bar" style="border: 1px solid hotpink;" on-fail="collapse"></pfe-icon>
349+
</pfe-card>
350+
</div>
327351
</body>
328352
</html>

elements/pfe-icon/package-lock.json

Lines changed: 7 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

elements/pfe-icon/src/pfe-icon.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<div class="pfe-icon--fallback">
2+
<slot></slot>
3+
</div>
14
<svg xmlns="http://www.w3.org/2000/svg">
25
<filter color-interpolation-filters="sRGB" x="0" y="0" height="100%" width="100%">
36
<feFlood result="COLOR" />

elements/pfe-icon/src/pfe-icon.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@ function _createIconSetHandler(el, setName) {
3333
}
3434

3535
function _iconLoad(el) {
36-
el.image.classList.remove("load-failed");
36+
el.classList.remove("load-failed");
3737
}
3838

3939
function _iconLoadError(el) {
40-
el.image.classList.add("load-failed");
40+
el.classList.add("load-failed");
41+
if(el.has_fallback) {
42+
el.classList.add("has-fallback");
43+
}
4144
}
4245

4346
class PfeIcon extends PFElement {
@@ -57,8 +60,12 @@ class PfeIcon extends PFElement {
5760
return "pfe-icon.json";
5861
}
5962

63+
get has_fallback() {
64+
return this.children.length > 0 || this.innerText.length > 0;
65+
}
66+
6067
static get observedAttributes() {
61-
return ["icon"];
68+
return ["icon", "on-fail"];
6269
}
6370

6471
constructor() {

0 commit comments

Comments
 (0)