-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2096 from hashicorp/br-app-footer-ts
`AppFooter` - Convert to Typescript
- Loading branch information
Showing
16 changed files
with
240 additions
and
76 deletions.
There are no files selected for viewing
This file contains 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,5 @@ | ||
--- | ||
"@hashicorp/design-system-components": minor | ||
--- | ||
|
||
`AppFooter` - Converted comonent to TypeScript |
1 change: 0 additions & 1 deletion
1
packages/components/src/components/hds/app-footer/copyright.hbs
This file contains 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{{! @glint-nocheck: not typesafe yet }} | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
|
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{{! @glint-nocheck: not typesafe yet }} | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
|
41 changes: 0 additions & 41 deletions
41
packages/components/src/components/hds/app-footer/index.js
This file was deleted.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
packages/components/src/components/hds/app-footer/index.ts
This file contains 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,70 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
import Component from '@glimmer/component'; | ||
|
||
import type { ComponentLike } from '@glint/template'; | ||
import type { HdsYieldSignature } from '../yield'; | ||
import type HdsAppFooterItemSignature from './legal-links'; | ||
import type HdsAppFooterLegalLinksSignature from './legal-links'; | ||
import type HdsAppFooterLinkSignature from './link'; | ||
import type HdsAppFooterStatusLinkSignature from './status-link'; | ||
import type { HdsAppFooterThemeTypes } from './types.ts'; | ||
|
||
export interface HdsAppFooterSignature { | ||
Args: { | ||
ariaLabel?: string; | ||
copyrightYear?: string; | ||
theme?: HdsAppFooterThemeTypes; | ||
}; | ||
Blocks: { | ||
default: [ | ||
{ | ||
ExtraBefore?: ComponentLike<HdsYieldSignature>; | ||
StatusLink?: ComponentLike<HdsAppFooterStatusLinkSignature>; | ||
LegalLinks?: ComponentLike<HdsAppFooterLegalLinksSignature>; | ||
Link?: ComponentLike<HdsAppFooterLinkSignature>; | ||
Item?: ComponentLike<HdsAppFooterItemSignature>; | ||
ExtraAfter?: ComponentLike<HdsYieldSignature>; | ||
} | ||
]; | ||
}; | ||
Element: HTMLDivElement; | ||
} | ||
|
||
export default class HdsAppFooterComponent extends Component<HdsAppFooterSignature> { | ||
/** | ||
* @param ariaLabel | ||
* @type {string} | ||
* @default 'Footer items' | ||
*/ | ||
get ariaLabel() { | ||
return this.args.ariaLabel ?? 'Footer items'; | ||
} | ||
|
||
/** | ||
* @param theme | ||
* @type {HdsAppFooterThemeTypes} | ||
* @description The component theme | ||
* @default 'light' | ||
*/ | ||
get theme() { | ||
return this.args.theme ?? 'light'; | ||
} | ||
|
||
/** | ||
* Get the class names to apply to the component. | ||
* @method classNames | ||
* @return {string} The "class" attribute to apply to the component. | ||
*/ | ||
get classNames() { | ||
const classes = ['hds-app-footer']; | ||
|
||
// add a class based on the @theme argument | ||
classes.push(`hds-app-footer--theme-${this.theme}`); | ||
|
||
return classes.join(' '); | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{{! @glint-nocheck: not typesafe yet }} | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
|
This file contains 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,15 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
import Component from '@glimmer/component'; | ||
|
||
export interface HdsAppFooterItemSignature { | ||
Blocks: { | ||
default: []; | ||
}; | ||
Element: HTMLLIElement; | ||
} | ||
|
||
export default class HdsAppFooterItemComponent extends Component<HdsAppFooterItemSignature> {} |
1 change: 0 additions & 1 deletion
1
packages/components/src/components/hds/app-footer/legal-links.hbs
This file contains 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{{! @glint-nocheck: not typesafe yet }} | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
|
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{{! @glint-nocheck: not typesafe yet }} | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
|
This file contains 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,24 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
import Component from '@glimmer/component'; | ||
|
||
import type { HdsInteractiveSignature } from '../interactive/'; | ||
import type { HdsLinkColors, HdsLinkIconPositions } from '../link/types.ts'; | ||
import type { HdsLinkInlineSignature } from '../link/inline.ts'; | ||
|
||
export interface HdsAppFooterLinkSignature { | ||
Args: HdsInteractiveSignature['Args'] & { | ||
color?: HdsLinkColors; | ||
icon?: string; | ||
iconPosition?: HdsLinkIconPositions; | ||
}; | ||
Blocks: { | ||
default: []; | ||
}; | ||
Element: HdsLinkInlineSignature['Element']; | ||
} | ||
|
||
export default class HdsAppFooterLinkComponent extends Component<HdsAppFooterLinkSignature> {} |
1 change: 0 additions & 1 deletion
1
packages/components/src/components/hds/app-footer/status-link.hbs
This file contains 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
{{! @glint-nocheck: not typesafe yet }} | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
|
This file contains 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
45 changes: 45 additions & 0 deletions
45
packages/components/src/components/hds/app-footer/types.ts
This file contains 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,45 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
export enum HdsAppFooterStatusValues { | ||
Operational = 'operational', | ||
Degraded = 'degraded', | ||
Maintenance = 'maintenance', | ||
Outage = 'outage', | ||
} | ||
|
||
export type HdsAppFooterStatusTypes = `${HdsAppFooterStatusValues}`; | ||
|
||
export const HdsAppFooterStatusLinkStatusValues: Record< | ||
HdsAppFooterStatusValues, | ||
{ | ||
text: string; | ||
iconName: string; | ||
} | ||
> = { | ||
[HdsAppFooterStatusValues.Operational]: { | ||
text: 'System operational', | ||
iconName: 'check-circle', | ||
}, | ||
[HdsAppFooterStatusValues.Degraded]: { | ||
text: 'System degraded', | ||
iconName: 'alert-triangle', | ||
}, | ||
[HdsAppFooterStatusValues.Maintenance]: { | ||
text: 'System maintenance', | ||
iconName: 'alert-triangle', | ||
}, | ||
[HdsAppFooterStatusValues.Outage]: { | ||
text: 'System outage', | ||
iconName: 'x-circle', | ||
}, | ||
}; | ||
|
||
export enum HdsAppFooterThemeValues { | ||
Light = 'light', | ||
Dark = 'dark', | ||
} | ||
|
||
export type HdsAppFooterThemeTypes = `${HdsAppFooterThemeValues}`; |
Oops, something went wrong.