Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppFrame: “Enterprise Nav” phase 1.5 updates (HDS-3612) #2299

Merged
merged 27 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4ab625e
HDS-3612 Add isHeaderFixed option to AppFrame, update layout styles f…
KristinLBradley Jul 29, 2024
58498f6
HDS-3612 Test moving SideNav positioning styles to AppFrame sidebar c…
KristinLBradley Jul 30, 2024
148a966
HDS-3612 Clean up CSS, fix z-indexs so AppHeader overlays SideNav and…
KristinLBradley Jul 31, 2024
c31fb03
HDS-3612 Add changeset
KristinLBradley Jul 31, 2024
7ccd26c
Update rich-actors-speak.md
KristinLBradley Jul 31, 2024
6893985
Update rich-actors-speak.md
KristinLBradley Jul 31, 2024
9bbdd38
Remove withAppHeade from SideNav examples as its no longer needed
KristinLBradley Jul 31, 2024
500c99c
HDS-3612 Add media query to 'unstick' AppHeader in views under 480px …
KristinLBradley Aug 1, 2024
a0e3774
Update rich-actors-speak.md
KristinLBradley Aug 1, 2024
6209023
HDS-3612 Update Showcase framed examples
KristinLBradley Aug 2, 2024
a46a46d
HDS-3612 Remove overrides for Showcase app width
KristinLBradley Aug 2, 2024
9913bb3
Apply suggestions from code review
KristinLBradley Aug 2, 2024
325de04
Apply suggestions from code review
KristinLBradley Aug 2, 2024
55a51c6
HDS-3612 Clarify wording of tests and add comments to label
KristinLBradley Aug 2, 2024
cccc0dd
HDS-3612 Override sticky positioning styles for AppFrame Showcase exa…
KristinLBradley Aug 5, 2024
5c70e65
HDS-3612 Override sticky positioning and related styles for AppFrame …
KristinLBradley Aug 5, 2024
359e1e7
HDS-3612 Remove isHeaderFixed option from AppFrame, refactor styles t…
KristinLBradley Aug 6, 2024
95367c0
HDS-3612 Update text label for Showcase example
KristinLBradley Aug 6, 2024
7d627ae
`AppFrame`: Remove withAppHeader argument from SideNav (HDS-3612) (#2…
KristinLBradley Aug 7, 2024
7d45361
Update rich-actors-speak.md
KristinLBradley Aug 7, 2024
d0ef473
Update rich-actors-speak.md
KristinLBradley Aug 8, 2024
4cfa169
HDS-3612 Remove classname getter
KristinLBradley Aug 8, 2024
945564c
HDS-3612 Refactor positioning styles of AppFrame children to referenc…
KristinLBradley Aug 8, 2024
b587ca2
HDS-3612 Add examples for disabled buttons in AppHeader to Showcase, …
KristinLBradley Aug 8, 2024
03ea5ff
HDS-3612 Add back disabled state styling to SideNav nested interactiv…
KristinLBradley Aug 8, 2024
27d1a21
Update showcase/app/styles/showcase-pages/app-frame.scss
KristinLBradley Aug 8, 2024
8c76c78
Update website/app/styles/pages/layouts/app-frame.scss
KristinLBradley Aug 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/rich-actors-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@hashicorp/design-system-components": minor
---

`AppFrame`:
- Modified sticky/fixed position to turn off when viewport height is under 480px in height
- Refactored styles to make `AppFrame` responsible for sticky/fixed layout of `SideNav` and `AppHeader`

`AppHeader`:
- Styled inoperable actions as disabled (which occurs when the `SideNav` is expanded in mobile view)

`SideNav`:
- Removed the `withAppHeader` option as it is no longer needed.
2 changes: 1 addition & 1 deletion packages/components/src/components/hds/app-frame/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: MPL-2.0
}}
<div class="hds-app-frame" ...attributes>
<div class={{this.classNames}} ...attributes>
{{#if this.hasHeader}}
{{yield (hash Header=(component "hds/app-frame/parts/header"))}}
{{/if}}
Expand Down
43 changes: 15 additions & 28 deletions packages/components/src/components/hds/app-frame/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,34 @@ export interface HdsAppFrameSignature {
}

export default class HdsAppFrameComponent extends Component<HdsAppFrameSignature> {
/**
* Indicates if the "header" container should be displayed
*
* @param hasHeader
* @type {boolean}
* @default true
*/
// Indicates if the "header" container should be displayed
get hasHeader(): boolean {
return this.args.hasHeader ?? true;
}

/**
* Indicates if the "sidebar" container should be displayed
*
* @param hasSidebar
* @type {boolean}
* @default true
*/
// Indicates if the "sidebar" container should be displayed
get hasSidebar(): boolean {
return this.args.hasSidebar ?? true;
}

/**
* Indicates if the "footer" container should be displayed
*
* @param hasFooter
* @type {boolean}
* @default true
*/
// Indicates if the "footer" container should be displayed
get hasFooter(): boolean {
return this.args.hasFooter ?? true;
}

/**
* Indicates if the "modals" container should be displayed
*
* @param hasModals
* @type {boolean}
* @default true
*/
// Indicates if the "modals" container should be displayed
get hasModals(): boolean {
return this.args.hasModals ?? true;
}

// Get the class names to apply to the component.
get classNames(): string {
KristinLBradley marked this conversation as resolved.
Show resolved Hide resolved
const classes = ['hds-app-frame'];

if (this.hasHeader && this.hasSidebar) {
classes.push('hds-app-frame--has-header-with-sidebar');
}

return classes.join(' ');
}
}
6 changes: 0 additions & 6 deletions packages/components/src/components/hds/side-nav/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ interface HdsSideNavSignature {
onToggleMinimizedStatus?: (arg: boolean) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onDesktopViewportChange?: (arg: boolean) => void;
withAppHeader?: boolean;
};
Blocks: {
header?: [
Expand Down Expand Up @@ -146,11 +145,6 @@ export default class HdsSideNavComponent extends Component<HdsSideNavSignature>
classes.push('hds-side-nav--is-animating');
}

// Add class based on the presence of app-header
if (this.args.withAppHeader) {
classes.push('hds-side-nav--with-app-header');
}

return classes.join(' ');
}

Expand Down
28 changes: 17 additions & 11 deletions packages/components/src/styles/components/app-frame.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,16 @@
grid-template-rows: auto 1fr auto;
grid-template-columns: auto 1fr;
min-height: 100vh;

// prevent interaction with AppHeader when SideNav is open/expanded
&:has(.hds-side-nav--is-not-minimized) .hds-app-header--is-mobile {
pointer-events: none;
}
}


// FRAME'S CONTAINERS

.hds-app-frame__header {
z-index: 7;
z-index: 21; // needs to stay above the main content & sidebar
grid-area: header;

// NOTE: May not need to qualify this with .hds-app-header as it may not matter if AppHeader is not present
&:has(.hds-app-header) {
// Make header position sticky/fixed if the viewport height is greater than 480px
@media (height >= 480px) {
position: sticky;
top: 0;
right: 0;
Expand All @@ -40,8 +34,21 @@
}

.hds-app-frame__sidebar {
z-index: 6;
position: sticky;
didoo marked this conversation as resolved.
Show resolved Hide resolved
top: 0;
z-index: 20; // needs to stay above the main content
grid-area: sidebar;
height: 100vh;
min-height: 100vh;

// Modify sidenav layout when used together with fixed app-header
@media (height >= 480px) {
.hds-app-frame--has-header-with-sidebar & {
top: var(--token-app-header-height);
height: calc(100vh - var(--token-app-header-height));
min-height: calc(100vh - var(--token-app-header-height));
}
}
}

.hds-app-frame__main {
Expand All @@ -52,7 +59,6 @@
grid-area: footer;
}


// MODALS "CONTAINER"

.hds-app-frame__modals {
Expand Down
38 changes: 37 additions & 1 deletion packages/components/src/styles/components/app-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

.hds-app-header {
position: relative;
z-index: 20; // needs to stay above the main content
display: flex;
gap: 12px;
align-items: center;
Expand Down Expand Up @@ -76,6 +75,30 @@
.hds-dropdown-toggle-button,
.hds-dropdown-toggle-icon {
@include hds-interactive-dark-theme();

// disabled state:
&:disabled,
&[disabled],
&.mock-disabled,
&:disabled:focus,
&[disabled]:focus,
&.mock-disabled:focus,
&:disabled:hover,
&[disabled]:hover,
&.mock-disabled:hover {
@include hds-interactive-dark-theme-state-disabled();
KristinLBradley marked this conversation as resolved.
Show resolved Hide resolved
}
}
}

// prevent interaction with AppHeader when SideNav is open/expanded
didoo marked this conversation as resolved.
Show resolved Hide resolved
.hds-app-frame:has(.hds-side-nav--is-not-minimized) .hds-app-header--is-mobile {
.hds-button,
.hds-dropdown-toggle-button,
.hds-dropdown-toggle-icon,
.hds-app-header__home-link {
@include hds-interactive-dark-theme-state-disabled(); // emulate disabled state
pointer-events: none;
}
}

Expand All @@ -90,6 +113,19 @@
// Set home link container size:
width: var(--token-app-header-home-link-size);
height: var(--token-app-header-home-link-size);

// disabled state:
&:disabled,
&[disabled],
&.mock-disabled,
&:disabled:focus,
&[disabled]:focus,
&.mock-disabled:focus,
&:disabled:hover,
&[disabled]:hover,
&.mock-disabled:hover {
@include hds-interactive-dark-theme-state-disabled();
}

// Set SVG logo size:
svg {
Expand Down
39 changes: 39 additions & 0 deletions packages/components/src/styles/components/side-nav/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@
width: 100%;
height: 100%;
padding: calc(var(--token-side-nav-header-home-link-padding) - 1px); // by design - we take in account the transparent border

// disabled state:
&:disabled,
KristinLBradley marked this conversation as resolved.
Show resolved Hide resolved
&[disabled],
&.mock-disabled,
&:disabled:focus,
&[disabled]:focus,
&.mock-disabled:focus,
&:disabled:hover,
&[disabled]:hover,
&.mock-disabled:hover {
@include hds-interactive-dark-theme-state-disabled();
}
}


Expand All @@ -67,6 +80,19 @@
.hds-dropdown-toggle-button,
.hds-dropdown-toggle-icon {
@include hds-interactive-dark-theme();

// disabled state:
&:disabled,
&[disabled],
&.mock-disabled,
&:disabled:focus,
&[disabled]:focus,
&.mock-disabled:focus,
&:disabled:hover,
&[disabled]:hover,
&.mock-disabled:hover {
@include hds-interactive-dark-theme-state-disabled();
}
}
}

Expand All @@ -81,4 +107,17 @@
width: 36px; // same height as the dropdown "toggle"
height: 36px;
padding: 5px; // we take in account the transparent border

// disabled state:
&:disabled,
&[disabled],
&.mock-disabled,
&:disabled:focus,
&[disabled]:focus,
&.mock-disabled:focus,
&:disabled:hover,
&[disabled]:hover,
&.mock-disabled:hover {
@include hds-interactive-dark-theme-state-disabled();
}
}
17 changes: 3 additions & 14 deletions packages/components/src/styles/components/side-nav/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,14 @@
//

.hds-side-nav {
KristinLBradley marked this conversation as resolved.
Show resolved Hide resolved
position: sticky;
top: 0;
z-index: 20; // needs to stay above the main content
position: relative;
width: var(--hds-app-sidenav-width-fixed); // "default" width used by the `SideNav::Base` subcomponent (that is not responsive)
height: 100vh;
min-height: 100vh;
height: 100%;
min-height: 100%;
isolation: isolate; // used to create a new stacking context (so we can set the overlay's z-index to -1)

// VARIATIONS

// with-app-header
// Modify sidenav layout when used together with app-header

&.hds-side-nav--with-app-header {
top: var(--token-app-header-height);
height: calc(100vh - var(--token-app-header-height));
min-height: calc(100vh - var(--token-app-header-height));
}

// headerless
// SideNav without a :header block
&.hds-side-nav--is-headerless {
Expand Down
19 changes: 5 additions & 14 deletions packages/components/src/styles/mixins/_interactive-dark-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,10 @@
border-color: var(--token-color-palette-neutral-400);
}
}
}

// Disabled:
&:disabled,
&[disabled],
&.mock-disabled,
&:disabled:focus,
&[disabled]:focus,
&.mock-disabled:focus,
&:disabled:hover,
&[disabled]:hover,
&.mock-disabled:hover {
color: var(--token-color-foreground-disabled);
background-color: var(--token-color-palette-neutral-600);
border-color: var(--token-color-palette-neutral-500);
}
@mixin hds-interactive-dark-theme-state-disabled() {
color: var(--token-color-foreground-disabled);
background-color: var(--token-color-palette-neutral-600);
border-color: var(--token-color-palette-neutral-500);
}
12 changes: 12 additions & 0 deletions showcase/app/styles/showcase-pages/app-frame.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ body.layouts-app-frame {
width: 100%;
height: 100%;
}

// remove sticky positioning from examples
.hds-app-frame__header,
.hds-app-frame__sidebar {
position: relative;
top: 0;
KristinLBradley marked this conversation as resolved.
Show resolved Hide resolved
}

.hds-app-frame__sidebar {
height: auto;
min-height: 0;
}
}

.shw-layout-app-frame-wrapper--with-3d {
Expand Down
8 changes: 4 additions & 4 deletions showcase/app/templates/components/app-header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
<Shw::Text::H4>States</Shw::Text::H4>

<Shw::Flex as |SF|>
{{#let (array "default" "hover" "active" "focus") as |states|}}
{{#let (array "default" "hover" "active" "focus" "disabled") as |states|}}
{{#each states as |state|}}
<SF.Item @label={{state}}>
<div class="hds-app-header">
Expand All @@ -324,7 +324,7 @@
</Shw::Flex>

<Shw::Flex as |SF|>
{{#let (array "default" "hover" "active" "focus") as |states|}}
{{#let (array "default" "hover" "active" "focus" "disabled") as |states|}}
{{#each states as |state|}}
<SF.Item>
<div class="hds-app-header">
Expand All @@ -349,7 +349,7 @@

<Shw::Text::Body>Secondary</Shw::Text::Body>
<Shw::Flex as |SF|>
{{#let (array "default" "hover" "active" "focus") as |states|}}
{{#let (array "default" "hover" "active" "focus" "disabled") as |states|}}
{{#each states as |state|}}
<SF.Item @label={{state}}>
<div class="hds-app-header">
Expand All @@ -368,7 +368,7 @@

<Shw::Text::Body>Primary</Shw::Text::Body>
<Shw::Flex as |SF|>
{{#let (array "default" "hover" "active" "focus") as |states|}}
{{#let (array "default" "hover" "active" "focus" "disabled") as |states|}}
{{#each states as |state|}}
<SF.Item @label={{state}}>

Expand Down
Loading