Skip to content

Commit

Permalink
use prop for headline, not slot
Browse files Browse the repository at this point in the history
  • Loading branch information
BoppLi committed Jul 10, 2024
1 parent 5384613 commit 290ff77
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@ const emit = defineEmits<{
"update:open": [isOpen: boolean];
}>();
const slots = defineSlots<{
defineSlots<{
/**
* Slot for the menu content when it's open.
*/
default(): unknown;
/**
* Slot for a headline of the menu content when it's open
*/
headline?(): unknown;
}>();
</script>

Expand All @@ -43,10 +39,10 @@ const slots = defineSlots<{
<div class="onyx-mobile-nav-button__flyout">
<div
class="onyx-mobile-nav-button__menu"
:class="{ 'onyx-mobile-nav-button__menu--no-headline': !slots.headline }"
:class="{ 'onyx-mobile-nav-button__menu--no-headline': !props.headline }"
>
<OnyxHeadline is="h2" v-if="slots.headline" class="onyx-mobile-nav-button__headline">
<slot name="headline"></slot>
<OnyxHeadline is="h2" v-if="props.headline" class="onyx-mobile-nav-button__headline">
{{ props.headline }}
</OnyxHeadline>

<slot></slot>
Expand Down
4 changes: 4 additions & 0 deletions packages/sit-onyx/src/components/OnyxMobileNavButton/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ export type OnyxMobileNavButtonProps = {
* If `true`, an "x" icon will be displayed.
*/
open?: boolean;
/**
* Headline of the mobile flyout
*/
headline?: string;
};
5 changes: 1 addition & 4 deletions packages/sit-onyx/src/components/OnyxNavBar/OnyxNavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,9 @@ defineExpose({
class="onyx-nav-bar__burger"
:icon="menu"
:label="t('navigation.toggleBurgerMenu')"
:headline="t('navigation.navigationHeadline')"
@update:open="isContextOpen = false"
>
<template #headline>
{{ t("navigation.navigationHeadline") }}
</template>

<nav class="onyx-nav-bar__nav--mobile">
<ul role="menubar">
<slot></slot>
Expand Down

0 comments on commit 290ff77

Please sign in to comment.