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

feat(topbar): add new look for application drawer trigger button when triggerGroupShortName is set #282

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions components/topbar/src/application-drawer.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { makeStyles, shorthands, tokens } from "@fluentui/react-components";

const triggerSpacingWithGroup = tokens.spacingHorizontalS;

export const useApplicationDrawrStyles = makeStyles({
drawer: {
...shorthands.borderRight(0),
Expand Down Expand Up @@ -48,6 +50,10 @@ export const useApplicationDrawrStyles = makeStyles({
...shorthands.gap(tokens.spacingHorizontalS),
...shorthands.padding(tokens.spacingVerticalXS, tokens.spacingHorizontalM),
},
drawerTriggerApplicationWithGroup: {
...shorthands.gap(triggerSpacingWithGroup),
...shorthands.padding(tokens.spacingVerticalXS, triggerSpacingWithGroup),
},
drawerTriggerApplicationIcon: {
display: "flex",
color: tokens.colorNeutralForeground2,
Expand All @@ -61,6 +67,18 @@ export const useApplicationDrawrStyles = makeStyles({
drawerTriggerApplicationText: {
color: tokens.colorNeutralForeground2,
},
drawerTriggerTextWithGroup: {
marginLeft: triggerSpacingWithGroup,
color: tokens.colorNeutralForeground2,
},
triggerDividerWithGroup: {
...shorthands.border("0.5px", "solid", tokens.colorNeutralForeground2),
...shorthands.borderRadius("1px"),
height: "12px",
boxSizing: "border-box",
marginTop: "1px",
marginLeft: triggerSpacingWithGroup,
},
applicationGroupTitle: {
display: "flex",
alignItems: "center",
Expand Down
19 changes: 17 additions & 2 deletions components/topbar/src/application-drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,25 @@ const DrawerTrigger = (
onMouseLeave={() => setHover(false)}
>
{<ApplicationAreaIcon applicationArea={applicationArea} />}
<Divider vertical style={{ padding: "0 0 0 12px" }}></Divider>
{currentSelection?.triggerGroupShortName
? (
<>
<Body1Strong className={styles.drawerTriggerTextWithGroup}>
{currentSelection?.triggerGroupShortName}
</Body1Strong>
<div className={styles.triggerDividerWithGroup}></div>
</>
)
: <Divider vertical style={{ padding: "0 0 0 12px" }}></Divider>}
{currentSelection
? (
<div className={styles.drawerTriggerApplication}>
<div
className={mergeClasses(
styles.drawerTriggerApplication,
currentSelection?.triggerGroupShortName
&& styles.drawerTriggerApplicationWithGroup
)}
>
<div
className={mergeClasses(
styles.drawerTriggerApplicationIcon,
Expand Down
8 changes: 7 additions & 1 deletion components/topbar/src/application-drawer.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ export type SingleApplicationDrawerContent = {
icon: JSX.Element;
/** Label to show in opened drawer. */
label: string;
/** Label to show in drawer trigger button when drawer is closed.
/**
* @deprecated
* Label to show in drawer trigger button when drawer is closed.
* If not set, label will be used.
* Unused for content with children.
*/
triggerLabel?: string;
/**
* Group label to show before triggerLabel
*/
triggerGroupShortName?: string;
};

export type ApplicationDrawerProps = {
Expand Down
2 changes: 2 additions & 0 deletions examples/src/components/top-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const Navbar = () => {
icon: <FishIcon />,
label: "Fisk",
id: "fisk",
triggerGroupShortName: "FISH",
},
{
icon: <CatIcon />,
Expand All @@ -98,6 +99,7 @@ export const Navbar = () => {
label: "Add",
triggerLabel: "ADD trigger",
id: "add",
triggerGroupShortName: "ADD",
},
];

Expand Down
Loading