Skip to content

Commit 1a4c973

Browse files
authored
feat: Add compact variant to GSB (#1402)
* feat(gsb): change slim to compact, add stories * chore: changeset
1 parent 0016be8 commit 1a4c973

7 files changed

Lines changed: 101 additions & 1 deletion

File tree

.changeset/nervous-beers-buy.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@astrouxds/angular": minor
3+
"@astrouxds/astro-web-components": minor
4+
"angular-workspace": minor
5+
"astro-angular": minor
6+
"astro-react": minor
7+
"astro-vue": minor
8+
"@astrouxds/react": minor
9+
---
10+
11+
Add compact prop to global status bar

packages/web-components/src/components.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ export namespace Components {
307307
* Sets the version of the application to be displayed in the app-meta element
308308
*/
309309
"appVersion"?: string;
310+
/**
311+
* Reduces the height of the global status bar
312+
*/
313+
"compact": boolean;
310314
/**
311315
* Declares whether the menu-icon will be shown in the left-side slot
312316
*/
@@ -35884,6 +35888,10 @@ declare namespace LocalJSX {
3588435888
* Sets the version of the application to be displayed in the app-meta element
3588535889
*/
3588635890
"appVersion"?: string;
35891+
/**
35892+
* Reduces the height of the global status bar
35893+
*/
35894+
"compact"?: boolean;
3588735895
/**
3588835896
* Declares whether the menu-icon will be shown in the left-side slot
3588935897
*/

packages/web-components/src/components/rux-global-status-bar/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ There is one unnamed slot in the Global Status Bar. This slot is intended for an
118118
| `appState` | `app-state` | Declares what text will render and whether the app-state component will be shown in the app-meta slot | `string \| undefined` | `''` |
119119
| `appStateColor` | `app-state-color` | Declares the color of the the app-state component background | `"tag1" \| "tag2" \| "tag3" \| "tag4" \| undefined` | `'tag1'` |
120120
| `appVersion` | `app-version` | Sets the version of the application to be displayed in the app-meta element | `string \| undefined` | `undefined` |
121+
| `compact` | `compact` | Reduces the height of the global status bar | `boolean` | `false` |
121122
| `includeIcon` | `include-icon` | Declares whether the menu-icon will be shown in the left-side slot | `boolean` | `false` |
122123
| `menuIcon` | `menu-icon` | Sets the icon to be displayed in the default rux-icon component | `string` | `'apps'` |
123124
| `username` | `username` | Declares what text will render and whether the username component will be shown in the app-meta slot | `string \| undefined` | `''` |

packages/web-components/src/components/rux-global-status-bar/rux-global-status-bar.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@
7171
:host([hidden]) {
7272
display: none;
7373
}
74+
:host([compact]) {
75+
min-height: var(--spacing-14);
76+
height: var(--spacing-14);
77+
--font-heading-1-bold-font-size: 1.5rem;
78+
--font-heading-1-font-size: 1.5rem;
79+
--font-heading-6-font-size: 1rem;
80+
81+
::slotted(rux-clock) {
82+
--font-monospace-1-font-size: 1.5rem;
83+
}
84+
}
85+
86+
:host::part(app-meta) {
87+
--spacing-10: auto;
88+
}
7489

7590
header {
7691
display: flex;

packages/web-components/src/components/rux-global-status-bar/rux-global-status-bar.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Prop, Component, Host, h } from '@stencil/core'
1+
import { Component, Host, Prop, h } from '@stencil/core'
2+
23
import { AppMeta } from './appMeta/appMeta'
34

45
/**
@@ -75,6 +76,11 @@ export class RuxGlobalStatusBar {
7576
@Prop({ attribute: 'menu-icon', reflect: true })
7677
menuIcon: string = 'apps'
7778

79+
/**
80+
* Reduces the height of the global status bar
81+
*/
82+
@Prop({ attribute: 'compact', reflect: true }) compact: boolean = false
83+
7884
render() {
7985
return (
8086
<Host>

packages/web-components/src/stories/global-status-bar.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ The Global Status Bar is a full-width view across the top of an application —
3131

3232
<Canvas of={GlobalStatusBarStories.WithTabs} />
3333

34+
## Compact
35+
36+
The Compact version of Global Status Bar provides a smaller GSB when screen space is scarce. It is important to keep this in mind when
37+
slotting content into a Compact GSB. For example, hide the labels on any `<rux-clock>` slotted inside a Compact GSB.
38+
39+
<Canvas of={GlobalStatusBarStories.Compact} />
40+
3441
### Other Variants
3542

3643
<Canvas of={GlobalStatusBarStories.WithOtherVariants} />

packages/web-components/src/stories/global-status-bar.stories.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,43 @@ const GlobalStatusBarWithTabs = (args) => {
8484
`
8585
}
8686

87+
const GlobalStatusBarCompact = (args) => {
88+
return html`
89+
<div style="display: flex; justify-content: center;">
90+
<rux-global-status-bar
91+
include-icon="${args.includeIcon}"
92+
app-state="${args.appState}"
93+
app-state-color="${args.appStateColor}"
94+
username="${args.username}"
95+
app-domain="${args.appDomain}"
96+
app-name="${args.appName}"
97+
app-version="${args.appVersion}"
98+
menu-icon="${args.menuIcon}"
99+
compact="${args.compact}"
100+
>
101+
<rux-clock hide-labels></rux-clock>
102+
<div slot="right-side" style="display: flex; gap: 0.5rem;">
103+
<rux-icon
104+
icon="satellite-transmit"
105+
style="color: var(--color-status-normal)"
106+
size="32px"
107+
></rux-icon>
108+
<rux-icon
109+
icon="satellite-receive"
110+
style="color: var(--color-status-caution)"
111+
size="32px"
112+
></rux-icon>
113+
<rux-icon
114+
icon="satellite-off"
115+
style="color: var(--color-status-critical)"
116+
size="32px"
117+
></rux-icon>
118+
</div>
119+
</rux-global-status-bar>
120+
</div>
121+
`
122+
}
123+
87124
const OtherVariants = () => {
88125
return html`
89126
<style>
@@ -249,6 +286,21 @@ export const WithTabs = {
249286
name: 'With Tabs',
250287
}
251288

289+
export const Compact = {
290+
render: GlobalStatusBarCompact.bind(),
291+
292+
args: {
293+
appDomain: 'Astro',
294+
appName: 'Dashboard',
295+
appVersion: '4.0 Alpha',
296+
menuIcon: 'apps',
297+
includeIcon: true,
298+
compact: true,
299+
},
300+
301+
name: 'Compact',
302+
}
303+
252304
export const WithOtherVariants = {
253305
render: OtherVariants.bind(),
254306
name: 'Other Variants',

0 commit comments

Comments
 (0)