-
Notifications
You must be signed in to change notification settings - Fork 44
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 #1284 from hashicorp/app-frame-component
`AppFrame` component
- Loading branch information
Showing
36 changed files
with
855 additions
and
7 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 | ||
--- | ||
|
||
Added `AppFrame` component |
19 changes: 19 additions & 0 deletions
19
packages/components/addon/components/hds/app-frame/index.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
}} | ||
<div class="hds-app-frame" ...attributes> | ||
{{#if this.hasHeader}} | ||
{{yield (hash Header=(component "hds/app-frame/parts/header"))}} | ||
{{/if}} | ||
{{#if this.hasSidebar}} | ||
{{yield (hash Sidebar=(component "hds/app-frame/parts/sidebar"))}} | ||
{{/if}} | ||
{{yield (hash Main=(component "hds/app-frame/parts/main"))}} | ||
{{#if this.hasFooter}} | ||
{{yield (hash Footer=(component "hds/app-frame/parts/footer"))}} | ||
{{/if}} | ||
{{#if this.hasModals}} | ||
{{yield (hash Modals=(component "hds/app-frame/parts/modals"))}} | ||
{{/if}} | ||
</div> |
52 changes: 52 additions & 0 deletions
52
packages/components/addon/components/hds/app-frame/index.js
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,52 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
import Component from '@glimmer/component'; | ||
|
||
export default class HdsAppFrameIndexComponent extends Component { | ||
/** | ||
* Indicates if the "header" container should be displayed | ||
* | ||
* @param hasHeader | ||
* @type {boolean} | ||
* @default true | ||
*/ | ||
get hasHeader() { | ||
return this.args.hasHeader ?? true; | ||
} | ||
|
||
/** | ||
* Indicates if the "sidebar" container should be displayed | ||
* | ||
* @param hasSidebar | ||
* @type {boolean} | ||
* @default true | ||
*/ | ||
get hasSidebar() { | ||
return this.args.hasSidebar ?? true; | ||
} | ||
|
||
/** | ||
* Indicates if the "footer" container should be displayed | ||
* | ||
* @param hasFooter | ||
* @type {boolean} | ||
* @default true | ||
*/ | ||
get hasFooter() { | ||
return this.args.hasFooter ?? true; | ||
} | ||
|
||
/** | ||
* Indicates if the "modals" container should be displayed | ||
* | ||
* @param hasModals | ||
* @type {boolean} | ||
* @default true | ||
*/ | ||
get hasModals() { | ||
return this.args.hasModals ?? true; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/components/addon/components/hds/app-frame/parts/footer.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
}} | ||
<footer class="hds-app-frame__footer" ...attributes> | ||
{{yield}} | ||
</footer> |
7 changes: 7 additions & 0 deletions
7
packages/components/addon/components/hds/app-frame/parts/header.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
}} | ||
<header class="hds-app-frame__header" ...attributes> | ||
{{yield}} | ||
</header> |
7 changes: 7 additions & 0 deletions
7
packages/components/addon/components/hds/app-frame/parts/main.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
}} | ||
<main class="hds-app-frame__main" ...attributes> | ||
{{yield}} | ||
</main> |
6 changes: 6 additions & 0 deletions
6
packages/components/addon/components/hds/app-frame/parts/modals.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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
}} | ||
{{! we use `:empty` in CSS so we have to avoid whitespaces }} | ||
<div class="hds-app-frame__modals" ...attributes>{{~yield~}}</div> |
7 changes: 7 additions & 0 deletions
7
packages/components/addon/components/hds/app-frame/parts/sidebar.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: MPL-2.0 | ||
}} | ||
<aside class="hds-app-frame__sidebar" ...attributes> | ||
{{yield}} | ||
</aside> |
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,6 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
export { default } from '@hashicorp/design-system-components/components/hds/app-frame/index'; |
6 changes: 6 additions & 0 deletions
6
packages/components/app/components/hds/app-frame/parts/footer.js
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,6 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
export { default } from '@hashicorp/design-system-components/components/hds/app-frame/parts/footer'; |
6 changes: 6 additions & 0 deletions
6
packages/components/app/components/hds/app-frame/parts/header.js
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,6 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
export { default } from '@hashicorp/design-system-components/components/hds/app-frame/parts/header'; |
6 changes: 6 additions & 0 deletions
6
packages/components/app/components/hds/app-frame/parts/main.js
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,6 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
export { default } from '@hashicorp/design-system-components/components/hds/app-frame/parts/main'; |
6 changes: 6 additions & 0 deletions
6
packages/components/app/components/hds/app-frame/parts/modals.js
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,6 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
export { default } from '@hashicorp/design-system-components/components/hds/app-frame/parts/modals'; |
6 changes: 6 additions & 0 deletions
6
packages/components/app/components/hds/app-frame/parts/sidebar.js
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,6 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
export { default } from '@hashicorp/design-system-components/components/hds/app-frame/parts/sidebar'; |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
// | ||
// APP-FRAME | ||
// | ||
|
||
.hds-app-frame { | ||
display: grid; | ||
grid-template-areas: | ||
"header header" | ||
"sidebar main" | ||
"sidebar footer"; | ||
grid-template-rows: auto 1fr auto; | ||
grid-template-columns: auto 1fr; | ||
min-height: 100vh; | ||
} | ||
|
||
|
||
// FRAME'S CONTAINERS | ||
|
||
.hds-app-frame__header { | ||
z-index: 7; | ||
grid-area: header; | ||
} | ||
|
||
.hds-app-frame__sidebar { | ||
z-index: 6; | ||
grid-area: sidebar; | ||
} | ||
|
||
.hds-app-frame__main { | ||
grid-area: main; | ||
} | ||
|
||
.hds-app-frame__footer { | ||
z-index: 5; | ||
grid-area: footer; | ||
} | ||
|
||
|
||
// MODALS "CONTAINER" | ||
|
||
.hds-app-frame__modals { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
z-index: 100; | ||
width: 100vw; | ||
height: 100vh; | ||
pointer-events: none; | ||
|
||
// since the content is injected via DOM manipulation, there's no issues of whitespace generated by Ember | ||
// that make this approach unreliable (in some cases), so we can safely use it to controls its display | ||
&:empty { | ||
display: none; | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
packages/components/tests/dummy/app/controllers/layouts/app-frame.js
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,17 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
import Controller from '@ember/controller'; | ||
import { action } from '@ember/object'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default class AppFrameController extends Controller { | ||
@tracked show3DVisualization = false; | ||
|
||
@action | ||
toggle3DVisualization() { | ||
this.show3DVisualization = !this.show3DVisualization; | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
packages/components/tests/dummy/app/routes/layouts/app-frame.js
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,8 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
import Route from '@ember/routing/route'; | ||
|
||
export default class ComponentsAppFrameRoute extends Route {} |
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
Oops, something went wrong.
bed4c3d
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.
Successfully deployed to the following URLs:
hds-showcase – ./packages/components
hds-showcase-hashicorp.vercel.app
hds-showcase-git-main-hashicorp.vercel.app
hds-showcase.vercel.app
bed4c3d
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.
Successfully deployed to the following URLs:
hds-website – ./website
hds-website-hashicorp.vercel.app
hds-website.vercel.app
flight-hashicorp.vercel.app
hds-website-git-main-hashicorp.vercel.app
design-system-components-hashicorp.vercel.app
helios.hashicorp.design