From 53e873bd943f2e39a5c71ad866ce11fe57387eb9 Mon Sep 17 00:00:00 2001 From: Marcus Feitoza Date: Sun, 5 Apr 2020 03:20:10 -0300 Subject: [PATCH] feat(uishell): global header utilities --- src/components/UIShell/UIShell.Story.svelte | 21 ++ src/components/UIShell/UIShell.stories.js | 10 + src/components/UIShell/UIShell.svelte | 1 + .../UIShellNav/UIShellUtilities.svelte | 7 + .../UIShellNav/UtilityComponent.svelte | 39 ++++ .../UIShell/UIShellNav/UtilityLink.svelte | 92 ++++++++ .../UIShell/UIShellNav/UtilitySearch.svelte | 207 ++++++++++++++++++ src/components/UIShell/constants.js | 10 + 8 files changed, 387 insertions(+) create mode 100644 src/components/UIShell/UIShellNav/UIShellUtilities.svelte create mode 100644 src/components/UIShell/UIShellNav/UtilityComponent.svelte create mode 100644 src/components/UIShell/UIShellNav/UtilityLink.svelte create mode 100644 src/components/UIShell/UIShellNav/UtilitySearch.svelte diff --git a/src/components/UIShell/UIShell.Story.svelte b/src/components/UIShell/UIShell.Story.svelte index d57734fe..c3836782 100644 --- a/src/components/UIShell/UIShell.Story.svelte +++ b/src/components/UIShell/UIShell.Story.svelte @@ -3,6 +3,7 @@ import UIShell from './UIShell.svelte'; import SettingsAdjust20 from 'carbon-icons-svelte/lib/SettingsAdjust20'; + import Help20 from 'carbon-icons-svelte/lib/Help20'; import ChangeCatalog16 from 'carbon-icons-svelte/lib/ChangeCatalog16'; import ManageProtection16 from 'carbon-icons-svelte/lib/ManageProtection16'; @@ -14,6 +15,9 @@ import UIShellNav from './UIShellNav/UIShellNav.svelte'; import UIShellNavItem from './UIShellNav/UIShellNavItem.svelte'; import UIShellNavSubmenu from './UIShellNav/UIShellNavSubmenu.svelte'; + import UIShellUtilities from './UIShellNav/UIShellUtilities.svelte'; + import UtilitySearch from './UIShellNav/UtilitySearch.svelte'; + import UtilityComponent from './UIShellNav/UtilityComponent.svelte'; let iCatalog = { class: undefined, @@ -25,6 +29,16 @@ style: undefined }; + let iHelp = { + class: undefined, + skeleton: false, + render: Help20, + title: 'Help', + tabindex: '0', + focusable: false, + style: undefined + }; + let iAdjust = { class: undefined, skeleton: false, @@ -61,6 +75,13 @@ +{:else if story === 'with-actions'} + + + + + + {:else if story === 'with-actions-sidenav'}
diff --git a/src/components/UIShell/UIShell.stories.js b/src/components/UIShell/UIShell.stories.js index 1e485083..a85e8be9 100644 --- a/src/components/UIShell/UIShell.stories.js +++ b/src/components/UIShell/UIShell.stories.js @@ -13,6 +13,16 @@ export const WithNav = () => ({ } }); +export const WithActions = () => ({ + Component, + props: { + story: 'with-actions', + href: text('The link href (href)', '#'), + company: text('Company name', 'IBM'), + platformName: text('Platform name', 'Platform Name') + } +}); + export const WithActionsAndSidenav = () => ({ Component, props: { diff --git a/src/components/UIShell/UIShell.svelte b/src/components/UIShell/UIShell.svelte index 94056266..ad64fe2c 100644 --- a/src/components/UIShell/UIShell.svelte +++ b/src/components/UIShell/UIShell.svelte @@ -25,5 +25,6 @@  {platformName} + diff --git a/src/components/UIShell/UIShellNav/UIShellUtilities.svelte b/src/components/UIShell/UIShellNav/UIShellUtilities.svelte new file mode 100644 index 00000000..9dd6eaf2 --- /dev/null +++ b/src/components/UIShell/UIShellNav/UIShellUtilities.svelte @@ -0,0 +1,7 @@ + + +
+ +
diff --git a/src/components/UIShell/UIShellNav/UtilityComponent.svelte b/src/components/UIShell/UIShellNav/UtilityComponent.svelte new file mode 100644 index 00000000..4fa6e3e2 --- /dev/null +++ b/src/components/UIShell/UIShellNav/UtilityComponent.svelte @@ -0,0 +1,39 @@ + + + + +
+ + {#if componentIsActive} +
+
+ +
+
+ {/if} +
diff --git a/src/components/UIShell/UIShellNav/UtilityLink.svelte b/src/components/UIShell/UIShellNav/UtilityLink.svelte new file mode 100644 index 00000000..5cd9c0ee --- /dev/null +++ b/src/components/UIShell/UIShellNav/UtilityLink.svelte @@ -0,0 +1,92 @@ + + + + +{#if type === leftPanelTypes.link} + + + +{:else} + + {#if linkIsActive && type === leftPanelTypes.links} +
+
    + {#each content as subject} + {#if subject.subject} +
  • + {subject.subject} +
  • + {/if} + {#each subject.items as link} +
  • + {link.text} +
  • + {/each} + {/each} +
+
+ {/if} +{/if} diff --git a/src/components/UIShell/UIShellNav/UtilitySearch.svelte b/src/components/UIShell/UIShellNav/UtilitySearch.svelte new file mode 100644 index 00000000..4bea4a2f --- /dev/null +++ b/src/components/UIShell/UIShellNav/UtilitySearch.svelte @@ -0,0 +1,207 @@ + + + + + + + diff --git a/src/components/UIShell/constants.js b/src/components/UIShell/constants.js index 2b6b49f5..377ea7ee 100644 --- a/src/components/UIShell/constants.js +++ b/src/components/UIShell/constants.js @@ -84,3 +84,13 @@ export const closeIcon = { focusable: false, style: undefined }; + +export const searchIcon = { + class: undefined, + skeleton: false, + render: Search20, + title: 'Search', + tabindex: '0', + focusable: false, + style: undefined +};