Skip to content

Commit 4dcd26d

Browse files
committed
feat(commandbar): add option for gutter
1 parent 56d562a commit 4dcd26d

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

workspaces/core/scss/components/_command-bar.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@
1010
align-items: center;
1111
color: var(--#{$shale}text-colour);
1212
}
13+
14+
.#{$shale}command-bar--gutter {
15+
padding-inline: var(--#{$shale}font-2);
16+
padding-block: var(--#{$shale}font--1);
17+
}

workspaces/react/reports/react.api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface BaseButtonProps {
1717
// @alpha (undocumented)
1818
export interface BaseCommandBarProps {
1919
flexGrow?: boolean;
20+
gutter?: boolean;
2021
}
2122

2223
// @alpha (undocumented)
@@ -61,7 +62,7 @@ export interface CardProps {
6162
export const Code: PolymorphicComponent<"code">;
6263

6364
// @alpha
64-
export const CommandBar: PolymorphicComponent<"div", BaseCommandBarProps>;
65+
export const CommandBar: PolymorphicComponent<typeof FlexContainer, BaseCommandBarProps>;
6566

6667
// @alpha (undocumented)
6768
export type ComponentProp<C extends ElementType> = {

workspaces/react/src/components/CommandBar.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import type { PolymorphicComponent } from "../types/helpers";
22
import { css } from "../utils/css";
3+
import { FlexContainer } from "./Container";
34

45
/** @alpha */
56
export interface BaseCommandBarProps {
67
/** Whether to make the command bar grow to fill available space */
78
flexGrow?: boolean;
9+
/** Whether to add padding around the command bar */
10+
gutter?: boolean;
811
}
912

1013
/**
@@ -22,16 +25,16 @@ export interface BaseCommandBarProps {
2225
*
2326
* @alpha
2427
*/
25-
export const CommandBar: PolymorphicComponent<"div", BaseCommandBarProps> = ({
26-
Component = "div",
27-
flexGrow,
28-
...props
29-
}) => (
28+
export const CommandBar: PolymorphicComponent<
29+
typeof FlexContainer,
30+
BaseCommandBarProps
31+
> = ({ Component = FlexContainer, flexGrow, gutter, ...props }) => (
3032
<Component
3133
{...props}
3234
className={css(
3335
"shale-v1-command-bar",
3436
{ "shale-v1-flex-grow": flexGrow },
37+
{ "shale-v1-command-bar--gutter": gutter },
3538
props?.className,
3639
)}
3740
/>

0 commit comments

Comments
 (0)