forked from UCLALibrary/ucla-library-website-components
-
Notifications
You must be signed in to change notification settings - Fork 3
feat: creates the header main funkhaus component #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Sveb
wants to merge
39
commits into
funkhaus:main
Choose a base branch
from
Sveb:header-main-funkhaus
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+543
−13
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
33787b8
update package
Sveb 2e670a6
Merge remote-tracking branch 'upstream/main'
Sveb 09043d2
Merge remote-tracking branch 'upstream/main'
Sveb 99240ef
Merge remote-tracking branch 'upstream/main'
Sveb 8301316
Merge remote-tracking branch 'upstream/main'
Sveb b87f27e
Merge remote-tracking branch 'upstream/main'
Sveb 16e863a
Merge remote-tracking branch 'upstream/main'
Sveb 64208d8
Merge remote-tracking branch 'upstream/main'
Sveb d7ec61c
Merge remote-tracking branch 'upstream/main'
Sveb c2a2e75
Merge remote-tracking branch 'upstream/main'
Sveb 33211f0
Merge remote-tracking branch 'upstream/main'
Sveb fe816e4
Merge remote-tracking branch 'upstream/main'
Sveb 12b0865
Merge remote-tracking branch 'upstream/main'
Sveb daf45e8
Merge remote-tracking branch 'upstream/main'
Sveb 9dc1550
Merge remote-tracking branch 'upstream/main'
Sveb 499ad28
feat: crrates the header main funkhaus component
Sveb 85587b5
Adds the brand bar to the header
Sveb d8fac3c
Adds a slot for the search bar
Sveb 00d3ecc
adjusting the slot for searchbar
Sveb dbc7d1d
Adds the borders to the header and to the slotted item
Sveb d660e03
Merge remote-tracking branch 'upstream/main'
Sveb 74f59e4
remove the searchbar slot from the header
Sveb 99d7004
Update _header-main-funkahaus.scss
Sveb 6aa62f5
add the secondary nav header to the header.
Sveb cdea736
Merge remote-tracking branch 'upstream/main'
Sveb db8bcf4
Merge remote-tracking branch 'upstream/main'
Sveb 38310ea
Merge branch 'main' into header-main-funkhaus
Sveb b4107a3
Merge remote-tracking branch 'upstream/main'
Sveb d4be143
Update package.json
Sveb 97d98e3
Merge remote-tracking branch 'upstream/main'
Sveb da5c0a1
Merge remote-tracking branch 'upstream/main'
Sveb e15b515
Merge remote-tracking branch 'upstream/main'
Sveb 5d04aad
Merge remote-tracking branch 'upstream/main'
Sveb a52dd33
fix: run lint fix
Sveb 786e959
Merge remote-tracking branch 'upstream/main' into header-main-funkhaus
Sveb 92249fc
Create HeaderMainFunkhaus.spec.js
Sveb edba53a
chore: adjust story
Sveb b7e4f6b
Merge branch 'main' into header-main-funkhaus
Sveb 9f95191
fix: CI Percy error
Sveb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,5 @@ | |
| }, | ||
| "engines": { | ||
| "pnpm": "^9.12.1" | ||
| }, | ||
| "packageManager": "[email protected]" | ||
| } | ||
| } | ||
50 changes: 50 additions & 0 deletions
50
packages/vue-component-library/src/lib-components/GlobalHamburger.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <script setup lang="ts"> | ||
| import { computed } from 'vue' | ||
| import { useTheme } from '@/composables/useTheme' | ||
|
|
||
| const props = defineProps<GlobalHamburgerProps>() | ||
|
|
||
| // Emits | ||
| const emit = defineEmits(['toggle-menu']) | ||
|
|
||
| // Data | ||
| const theme = useTheme() | ||
|
|
||
| // Props | ||
| interface GlobalHamburgerProps { | ||
| isOpened: boolean | ||
| } | ||
|
|
||
| // Computed | ||
| const classes = computed(() => { | ||
| return [ | ||
| 'global-hamburger', | ||
| theme?.value || '', | ||
| { | ||
| 'is-opened': props.isOpened | ||
| } | ||
| ] | ||
| }) | ||
|
|
||
| // Methods | ||
| function onClick() { | ||
| emit('toggle-menu') | ||
| } | ||
| </script> | ||
|
|
||
| <template> | ||
| <div | ||
| :class="classes" | ||
| @click="onClick" | ||
| > | ||
| <div class="hamburger-lines"> | ||
| <span class="line line-1" /> | ||
| <span class="line line-2" /> | ||
| <span class="line line-3" /> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style scoped lang="scss"> | ||
| @import "@/styles/dlc/_global-hamburger.scss"; | ||
| </style> |
120 changes: 120 additions & 0 deletions
120
packages/vue-component-library/src/lib-components/HeaderMainFunkhaus.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| <script setup lang="ts"> | ||
| // Imports | ||
| import SvgLibraryLogo from 'ucla-library-design-tokens/assets/svgs/logo-library-digital-collections.svg' | ||
| import { computed } from 'vue' | ||
| import SmartLink from '@/lib-components/SmartLink.vue' | ||
| import GlobalHamburger from '@/lib-components/GlobalHamburger.vue' | ||
| import SiteBrandBar from '@/lib-components/SiteBrandBar.vue' | ||
|
|
||
| import { useTheme } from '@/composables/useTheme' | ||
|
|
||
| // Props | ||
| interface HeaderMainFunkhausProps { | ||
| menuOpened: boolean | ||
| showSecondary: boolean | ||
| menuItems: any[] | ||
| secondaryItems: any[] | ||
| } | ||
|
|
||
| const props = defineProps<HeaderMainFunkhausProps>() | ||
|
|
||
| // Emits | ||
| const emit = defineEmits(['toggle-menu']) | ||
|
|
||
| // Data | ||
| const theme = useTheme() | ||
|
|
||
| // Computed | ||
| const classes = computed(() => { | ||
| return ['header-main-funkahus', theme?.value || '', { 'menu-opened': props.menuOpened }] | ||
| }) | ||
|
|
||
| const parsedSubMenuItems = computed(() => { | ||
| return props.secondaryItems.map((item) => { | ||
| const supportUsClass = item.label?.toLowerCase() === 'support us' ? ' support-us' : '' | ||
|
|
||
| return { | ||
| ...item, | ||
| classes: supportUsClass | ||
| } | ||
| }) | ||
| }) | ||
|
|
||
| // Methods | ||
| function toggleMenu() { | ||
| emit('toggle-menu') | ||
| } | ||
|
|
||
| function handleAccountButtonClick() { | ||
| console.log('handleAccountButtonClick') | ||
| } | ||
| </script> | ||
|
|
||
| <template> | ||
| <div :class="classes"> | ||
| <SiteBrandBar class="brand-bar" /> | ||
|
|
||
| <ul | ||
| v-if="showSecondary" | ||
| class="container-secondary show-desktop" | ||
| > | ||
| <li | ||
| v-for="item in parsedSubMenuItems" | ||
| :key="item.label" | ||
| class="menu-item" | ||
| > | ||
| <SmartLink | ||
| :to="item.to" | ||
| :class="item.classes" | ||
| class="menu-link" | ||
| > | ||
| {{ item.label }} | ||
| </SmartLink> | ||
| </li> | ||
|
|
||
| <button | ||
| class="account-button" | ||
| @click="handleAccountButtonClick" | ||
| > | ||
| My Account | ||
| </button> | ||
| </ul> | ||
| <div class="container"> | ||
| <SmartLink | ||
| to="/" | ||
| class="ucla-dlc-logo-link" | ||
| > | ||
| <SvgLibraryLogo | ||
| class="ucla-dlc-logo" | ||
| alt="UCLA Library Digital Collections logo" | ||
| /> | ||
| </SmartLink> | ||
|
|
||
| <ul class="header-links show-desktop"> | ||
| <li | ||
| v-for="item in menuItems" | ||
| :key="item.label" | ||
| class="menu-item" | ||
| > | ||
| <SmartLink | ||
| :to="item.to" | ||
| :class="item.classes" | ||
| class="menu-link" | ||
| > | ||
| {{ item.label }} | ||
| </SmartLink> | ||
| </li> | ||
| </ul> | ||
|
|
||
| <GlobalHamburger | ||
| class="hamburger show-mobile" | ||
| :is-opened="menuOpened" | ||
| @toggle-menu="toggleMenu" | ||
| /> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style lang="scss" scoped> | ||
| @import "@/styles/dlc/_header-main-funkahaus.scss"; | ||
| </style> | ||
9 changes: 9 additions & 0 deletions
9
packages/vue-component-library/src/stories/HeaderMainFunkhaus.spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| describe('Funkhaus / Header Main Funkhaus', () => { | ||
| it('Default', () => { | ||
| cy.visit( | ||
| '/iframe.html?id=funkhaus-header-main-funkhaus--default&args=&viewMode=story' | ||
| ) | ||
| cy.get('.header-main-funkahus').should('exist') | ||
| // cy.percySnapshot('Funkhaus / Header Main Funkhaus: Default') | ||
| }) | ||
| }) |
58 changes: 58 additions & 0 deletions
58
packages/vue-component-library/src/stories/HeaderMainFunkhaus.stories.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { computed, provide, ref } from 'vue' | ||
| import HeaderMainFunkhaus from '@/lib-components/HeaderMainFunkhaus.vue' | ||
| import SmartLink from '@/lib-components/SmartLink.vue' | ||
|
|
||
| // Storybook default settings | ||
| export default { | ||
| title: 'Funkhaus / Header Main Funkhaus', | ||
| component: HeaderMainFunkhaus, | ||
| } | ||
|
|
||
| // Variations of stories below | ||
| export function Default() { | ||
| provide(() => { | ||
| return { | ||
| theme: computed(() => 'dlc'), | ||
| } | ||
| }) | ||
|
|
||
| return { | ||
| components: { HeaderMainFunkhaus, SmartLink }, | ||
| setup() { | ||
| const menuOpened = ref(false) | ||
|
|
||
| const toggleMenu = () => { | ||
| menuOpened.value = !menuOpened.value | ||
| } | ||
|
|
||
| const menuItems = [ | ||
| { | ||
| label: 'Using digital collections content', | ||
| to: '/digital-collections', | ||
| }, | ||
| { | ||
| label: 'About', | ||
| to: '/about', | ||
| }, | ||
| { | ||
| label: 'Give us feedback', | ||
| to: '/feedback', | ||
| } | ||
| ] | ||
|
|
||
| return { | ||
| menuOpened, | ||
| toggleMenu, | ||
| menuItems | ||
| } | ||
| }, | ||
| template: ` | ||
| <HeaderMainFunkhaus | ||
| :menu-opened="menuOpened" | ||
| @toggle-menu="toggleMenu" | ||
| :class="menuOpened ? 'menu-opened' : ''" | ||
| :menu-items="menuItems" | ||
| /> | ||
| `, | ||
| } | ||
| } |
50 changes: 50 additions & 0 deletions
50
packages/vue-component-library/src/styles/dlc/_global-hamburger.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| .global-hamburger, | ||
| .global-hamburger.dlc { | ||
| display: none; | ||
| cursor: pointer; | ||
|
|
||
| /* Breakpoints */ | ||
| @media #{$medium} { | ||
| display: block; | ||
|
|
||
| .hamburger-lines { | ||
| position: relative; | ||
| width: 24px; | ||
| height: 18px; | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| .line { | ||
| display: block; | ||
| height: 2px; | ||
| width: 100%; | ||
| background-color: var(--color-primary-blue-03); | ||
| border-radius: 1px; | ||
| transform-origin: center; | ||
|
|
||
| @include animate-normal; | ||
| } | ||
|
|
||
| // States | ||
| &.is-opened { | ||
| .line { | ||
| background-color: var(--color-white); | ||
| } | ||
|
|
||
| .line-1 { | ||
| transform: translateY(8px) rotate(45deg); | ||
| } | ||
|
|
||
| .line-2 { | ||
| opacity: 0; | ||
| transform: scaleX(0); | ||
| } | ||
|
|
||
| .line-3 { | ||
| transform: translateY(-8px) rotate(-45deg); | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CSS class name 'header-main-funkahus' has a spelling error. It should be 'header-main-funkhaus' to match the component name and avoid style application issues.