Skip to content

Commit

Permalink
chore: add header for angular and vue for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed May 10, 2024
1 parent 0d0757f commit 08cdcde
Show file tree
Hide file tree
Showing 11 changed files with 3,243 additions and 3,135 deletions.
6,137 changes: 3,014 additions & 3,123 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/components/scripts/post-build/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ const getComponents = () => [
angular: {
directives: [
{
name: 'ActionBar',
ngContentName: 'action-bar'
name: 'SecondaryAction',
ngContentName: 'secondary-action'
},
{
name: 'MetaNavigation',
Expand Down
20 changes: 14 additions & 6 deletions packages/components/src/components/page/page.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
@use "@db-ui/foundations/build/scss/variables";

@mixin header-footer-style {
> :is(.db-header, .db-footer, header, footer) {
display: flex;
flex: 0 1 auto;
flex-grow: 0;
flex-shrink: 0;
}
}

.db-page {
opacity: 0;

Expand All @@ -13,16 +22,15 @@
}

&[data-variant="fixed"] {

@include header-footer-style();
block-size: 100%;
min-block-size: 100%;
display: flex;
flex-direction: column;

> :is(.db-header, .db-footer, header, footer) {
display: flex;
flex: 0 1 auto;
flex-grow: 0;
flex-shrink: 0;
/* workaround for angular */
> :is(db-header, dbheader, dbfooter, db-footer) {
@include header-footer-style();
}

> .db-main {
Expand Down
4 changes: 2 additions & 2 deletions showcases/angular-showcase/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
}
</db-select>
</ng-container>
<ng-container call-to-action>
<ng-container primary-action>
<DBButton
icon="magnifying_glass"
variant="ghost"
[noText]="true"
>Search</DBButton
>
</ng-container>
<ng-container *dbActionBar>
<ng-container secondary-action>
<DBButton icon="user" variant="ghost" [noText]="true">
Profile
</DBButton>
Expand Down
4 changes: 2 additions & 2 deletions showcases/angular-showcase/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { ActivatedRoute, Router, RouterOutlet } from '@angular/router';
import {
ActionBarDirective,
SecondaryActionDirective,
NavigationDirective,
MetaNavigationDirective,
NavigationContentDirective,
Expand Down Expand Up @@ -39,7 +39,7 @@ import {
DBNavigation,
DBSelect,
DBButton,
ActionBarDirective,
SecondaryActionDirective,
NavigationDirective,
MetaNavigationDirective,
NavigationContentDirective
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<app-default-component
title="DBHeader"
[variants]="variants"
[exampleTemplate]="exampleTemplate"
>
<ng-template
#exampleTemplate
let-exampleProps="exampleProps"
let-exampleName="exampleName"
let-exampleIndex="exampleIndex"
let-variantIndex="variantIndex"
>
<db-header
[width]="exampleProps?.width"
[forceMobile]="exampleProps.forceMobile"
>
<db-brand brand>
@if (!exampleProps.example || exampleProps.withName) {
DBHeader
}
</db-brand>
<ng-container *dbNavigation>
@if (!exampleProps.example || exampleProps.withNavigation) {
<db-navigation>
<db-navigation>
<db-navigation-item icon="user">
<a href="#" *dbNavigationContent
>{{ exampleName }}
</a>
</db-navigation-item>
<db-navigation-item [disabled]="true">
<a href="#" *dbNavigationContent
>{{ exampleName }} disabled
</a>
</db-navigation-item>
</db-navigation>
</db-navigation>
}
</ng-container>
<ng-container *dbMetaNavigation>
@if (!exampleProps.example) {
<db-link href="#">Imprint</db-link>
<db-link href="#">Help</db-link>
}
</ng-container>
<ng-container primary-action>
@if (!exampleProps.example) {
<DBButton
icon="magnifying_glass"
variant="ghost"
[noText]="true"
>Search</DBButton
>
}
</ng-container>
<ng-container *secondaryAction>
@if (!exampleProps.example) {
<DBButton icon="user" variant="ghost" [noText]="true">
Profile
</DBButton>
<DBButton icon="bell" variant="ghost" [noText]="true">
Notification
</DBButton>
<DBButton
icon="question_mark_circle"
variant="ghost"
[noText]="true"
>
Help
</DBButton>
}
</ng-container>
</db-header>
</ng-template>
</app-default-component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Component } from '@angular/core';
import defaultComponentVariants from '../../../../../shared/header.json';
import { DefaultComponent } from '../default.component';
import {
DBBrand,
DBButton,
DBHeader,
DBLink,
DBNavigation,
DBNavigationItem,
MetaNavigationDirective,
NavigationContentDirective,
NavigationDirective,
SecondaryActionDirective
} from '../../../../../../output/angular/src';

@Component({
selector: 'app-header',
templateUrl: './header.component.html',
imports: [
DefaultComponent,
DBBrand,
DBButton,
DBHeader,
DBLink,
DBNavigation,
DBNavigationItem,
SecondaryActionDirective,
NavigationDirective,
MetaNavigationDirective,
NavigationContentDirective
],
standalone: true
})
export class HeaderComponent {
variants = defaultComponentVariants;
}
6 changes: 6 additions & 0 deletions showcases/angular-showcase/src/app/utils/navigation-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { DividerComponent } from '../components/divider/divider.component';
import { DrawerComponent } from '../components/drawer/drawer.component';
import { IconComponent } from '../components/icon/icon.component';
import { BrandComponent } from '../components/brand/brand.component';
import { HeaderComponent } from '../components/header/header.component';

export type NavItem = {
path: string;
Expand Down Expand Up @@ -158,6 +159,11 @@ export const NAVIGATION_ITEMS: NavItem[] = [
path: '01/section',
label: 'Section',
component: SectionComponent
},
{
path: '01/header',
label: 'Header',
component: HeaderComponent
}
])
},
Expand Down
2 changes: 2 additions & 0 deletions showcases/shared/header.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"examples": [
{
"name": "Full",
"props": {},
"style": {
"width": "100%",
"display": "block"
Expand Down Expand Up @@ -104,6 +105,7 @@
"examples": [
{
"name": "Desktop (full width)",
"props": {},
"style": {
"width": "100%",
"display": "block"
Expand Down
83 changes: 83 additions & 0 deletions showcases/vue-showcase/src/components/header/Header.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<script setup lang="ts">
import DefaultComponent from "../DefaultComponent.vue";
import defaultComponentVariants from "../../../../shared/header.json";
import {
DBBrand,
DBButton,
DBHeader,
DBLink,
DBNavigation,
DBNavigationItem
} from "../../../../../output/vue/src";
</script>

<template>
<DefaultComponent title="DBHeader" :variants="defaultComponentVariants">
<template
#example="{ exampleIndex, variantIndex, exampleName, exampleProps }"
>
<DBHeader
:width="exampleProps.width"
:force-mobile="exampleProps.forceMobile"
>
<template v-slot:brand>
<DBBrand>
<template
v-if="
!exampleProps.example || exampleProps.withName
"
>
Showcase
</template>
</DBBrand>
</template>
<template
v-if="!exampleProps.example || exampleProps.withNavigation"
>
<DBNavigation>
<DBNavigationItem icon="user">
<a href="#">{{ exampleName }}</a>
</DBNavigationItem>
<DBNavigationItem :disabled="true">
<a href="#">{{ exampleName }} disabled</a>
</DBNavigationItem>
</DBNavigation>
</template>
<template v-slot:primary-action>
<template v-if="!exampleProps.example">
<DBButton
icon="magnifying_glass"
variant="ghost"
:no-text="true"
>
Search
</DBButton></template
>
</template>
<template v-slot:secondary-action>
<template v-if="!exampleProps.example">
<DBButton icon="user" variant="ghost" :no-text="true">
Profile
</DBButton>
<DBButton icon="bell" variant="ghost" :no-text="true">
Notification
</DBButton>
<DBButton
icon="question_mark_circle"
variant="ghost"
:no-text="true"
>
Help
</DBButton></template
>
</template>
<template v-slot:meta-navigation>
<template v-if="!exampleProps.example">
<DBLink href="#">Imprint</DBLink>
<DBLink href="#">Help</DBLink></template
>
</template>
</DBHeader>
</template>
</DefaultComponent>
</template>
6 changes: 6 additions & 0 deletions showcases/vue-showcase/src/utils/navigation-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Section from '../components/section/Section.vue';
import Textarea from '../components/textarea/Textarea.vue';
import Brand from '../components/brand/Brand.vue';
import Icon from '../components/icon/Icon.vue';
import Header from '../components/header/Header.vue';

export type NavItem = {
path: string;
Expand Down Expand Up @@ -142,6 +143,11 @@ export const navigationItems: NavItem[] = [
path: '/01/section',
label: 'Section',
component: Section
},
{
path: '/01/header',
label: 'Header',
component: Header
}
])
},
Expand Down

0 comments on commit 08cdcde

Please sign in to comment.