Skip to content

Commit

Permalink
Merge pull request #697 from hubmapconsortium/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
axdanbol authored Sep 6, 2024
2 parents 9df000b + 101389b commit e35dcb2
Show file tree
Hide file tree
Showing 19 changed files with 315 additions and 356 deletions.
5 changes: 1 addition & 4 deletions libs/design-system/assets/icons/social/email.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions libs/design-system/assets/icons/social/email_large.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions libs/design-system/breadcrumbs/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "src/index.ts"
}
}
1 change: 1 addition & 0 deletions libs/design-system/breadcrumbs/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/breadcrumbs-size/breadcrumbs-size.directive';
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { computed, Directive, input } from '@angular/core';

/** Input options for breadcrumb size */
export type BreadcrumbSize = 'small' | 'medium' | 'large';

/**
* Breadcrumb size config interface
*/
interface BreadcrumbConfig {
/** Height of component */
height: number;
/** Font variable for the component */
font: string;
}

/** Breadcrumb size config (numbers in rem) */
const BREADCRUMB_CONFIG: Record<BreadcrumbSize, BreadcrumbConfig> = {
small: {
height: 1.5,
font: '--sys-label-small',
},
medium: {
height: 1.5,
font: '--sys-label-medium',
},
large: {
height: 1.75,
font: '--sys-label-large',
},
};

/**
* Directive for breadcrumb sizes
*/
@Directive({
selector: '[hraBreadcrumbSize]',
standalone: true,
host: {
'[style.font]': 'fontVar()',
'[style.--mdc-text-button-container-height.rem]': 'buttonHeight()',
},
})
export class BreadcrumbsSizeDirective {
/** Size of breadcrumbs component */
readonly size = input.required<BreadcrumbSize>({ alias: 'hraBreadcrumbSize' });

/** Gets the font variable for the current breadcrumbs size */
protected readonly fontVar = computed(() => `var(${BREADCRUMB_CONFIG[this.size()].font})`);

/** Gets the button height for the current breadcrumbs size */
protected readonly buttonHeight = computed(() => BREADCRUMB_CONFIG[this.size()].height);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@for (crumb of crumbs(); track crumb; let last = $last) {
@if (!last) {
<a [routerLink]="crumb.route">
<button mat-button disableRipple [hraBreadcrumbSize]="size()">{{ crumb.name }}</button>
</a>
<mat-icon>chevron_right</mat-icon>
} @else {
<span [hraBreadcrumbSize]="size()">{{ crumb.name }}</span>
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:host {
display: flex;
align-items: center;
color: var(--sys-on-primary-fixed);

span,
button {
--mat-text-button-horizontal-padding: 0.25rem;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { provideDesignSystem } from '@hra-ui/design-system';
import { applicationConfig, type Meta, type StoryObj } from '@storybook/angular';

import { BreadcrumbsComponent } from './breadcrumbs.component';
import { provideRouter } from '@angular/router';

const sampleItem = { name: 'Button', route: 'A/B/C' };

const meta: Meta<BreadcrumbsComponent> = {
component: BreadcrumbsComponent,
title: 'Breadcrumbs',
parameters: {
design: {
type: 'figma',
url: 'https://www.figma.com/design/BCEJn9KCIbBJ5MzqnojKQp/Design-System-Components?node-id=892-4',
},
},
decorators: [
applicationConfig({
providers: [provideDesignSystem(), provideRouter([])],
}),
],
args: {
size: 'large',
},
argTypes: {
size: {
control: 'select',
options: ['small', 'medium', 'large'],
},
},
};
export default meta;
type Story = StoryObj<BreadcrumbsComponent>;

export const Short: Story = {
args: {
crumbs: [sampleItem, { name: 'Current Page' }],
},
};

export const Long: Story = {
args: {
crumbs: [sampleItem, sampleItem, sampleItem, { name: 'Current Page' }],
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
import { MatIconModule } from '@angular/material/icon';
import { RouterModule } from '@angular/router';
import { ButtonModule } from '@hra-ui/design-system/button';

import { BreadcrumbSize, BreadcrumbsSizeDirective } from '../breadcrumbs-size/breadcrumbs-size.directive';

/** Breadcrumb item */
interface BreadcrumbItem {
/** Name of item */
name: string;
/** Route to page */
route?: string;
}

/**
* Component used to help the user understand their location within websites
*/
@Component({
selector: 'hra-breadcrumbs',
standalone: true,
imports: [CommonModule, MatIconModule, ButtonModule, RouterModule, BreadcrumbsSizeDirective],
templateUrl: './breadcrumbs.component.html',
styleUrl: './breadcrumbs.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class BreadcrumbsComponent {
/** Size of breadcrumbs component */
readonly size = input.required<BreadcrumbSize>();

/** Crumbs to display */
readonly crumbs = input<BreadcrumbItem[]>([]);
}
8 changes: 8 additions & 0 deletions libs/design-system/button/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
export * from './lib/button-styles/button-styles.component';
export * from './lib/providers';
export * from './lib/button.module';

export * from './lib/button-size/button-size.directive';
export * from './lib/directives/call-to-action-button.directive';
export * from './lib/directives/nav-item-button.directive';
export * from './lib/directives/navigation-category-button.directive';
export * from './lib/directives/primary-button.directive';
export * from './lib/directives/secondary-button.directive';
56 changes: 17 additions & 39 deletions libs/design-system/footer/src/lib/footer.component.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,19 @@
<div class="footer-wrapper">
<div class="footer-left">
<a href="https://humanatlas.io" target="_blank" rel="noopener noreferrer">
<img [attr.src]="logo() | assetUrl" alt="Human Reference Atlas Logo" />
</a>
<span class="copyright">
<mat-icon fontSet="material-symbols-outlined">copyright</mat-icon>
2024 CNS at Indiana University
</span>
</div>
<div class="footer-right">
<div class="footer-left">
<a href="https://humanatlas.io" target="_blank" rel="noopener noreferrer">
<img [attr.src]="logo() | assetUrl" alt="Human Reference Atlas Logo" />
</a>
<span class="copyright">
<mat-icon fontSet="material-symbols-outlined">copyright</mat-icon>
2024 CNS at Indiana University
</span>
</div>
<div class="footer-right">
<div class="footer-right-content">
<div class="social-funded">
<div class="social-media">
<a href="https://twitter.com/cnscenter" target="_blank" rel="noopener noreferrer">
<mat-icon *ngIf="isExtraSmall" svgIcon="social:x"></mat-icon>
<mat-icon *ngIf="!isExtraSmall" svgIcon="social:x_large"></mat-icon>
</a>
<a href="https://www.facebook.com/cnscenter/" target="_blank" rel="noopener noreferrer">
<mat-icon *ngIf="isExtraSmall" svgIcon="social:facebook"></mat-icon>
<mat-icon *ngIf="!isExtraSmall" svgIcon="social:facebook_large"></mat-icon>
</a>
<a href="https://www.instagram.com/cns_at_iu/" target="_blank" rel="noopener noreferrer">
<mat-icon *ngIf="isExtraSmall" svgIcon="social:instagram"></mat-icon>
<mat-icon *ngIf="!isExtraSmall" svgIcon="social:instagram_large"></mat-icon>
</a>
<a href="https://www.youtube.com/@CNSCenter/" target="_blank" rel="noopener noreferrer">
<mat-icon *ngIf="isExtraSmall" svgIcon="social:youtube"></mat-icon>
<mat-icon *ngIf="!isExtraSmall" svgIcon="social:youtube_large"></mat-icon>
</a>
<a
href="https://www.linkedin.com/company/cns-indiana-university-bloomington"
target="_blank"
rel="noopener noreferrer"
>
<mat-icon *ngIf="isExtraSmall" svgIcon="social:linkedin"></mat-icon>
<mat-icon *ngIf="!isExtraSmall" svgIcon="social:linkedin_large"></mat-icon>
</a>
<a href="mailto:infoccf@iu.edu" rel="noopener noreferrer">
<mat-icon *ngIf="isExtraSmall" svgIcon="social:email"></mat-icon>
<mat-icon *ngIf="!isExtraSmall" svgIcon="social:email_large"></mat-icon>
</a>
@for (link of socialMediaNames; track link) {
<hra-social-media-button size="large" [name]="link"></hra-social-media-button>
}
</div>
<div class="funded-by">
<span>Funded By:</span>
Expand All @@ -52,6 +27,9 @@
<a href="https://cifar.ca/" target="_blank" rel="noopener noreferrer">
<img [attr.src]="'assets/logo/cifar.svg' | assetUrl" alt="CIFAR Logo" />
</a>
<div class="spacer"></div>
<div class="spacer"></div>
<div class="spacer"></div>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit e35dcb2

Please sign in to comment.