Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: make secondary styling more obvious
  • Loading branch information
Parkreiner committed Mar 11, 2025
commit e5d581b1832d61c21f9be0048c58c1402af6fb81
13 changes: 7 additions & 6 deletions site/src/components/SettingsHeader/SettingsHeader.tsx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a storybook for it covering the new variants?

Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ import { Stack } from "components/Stack/Stack";
import { SquareArrowOutUpRightIcon } from "lucide-react";
import type { FC, ReactNode } from "react";

interface HeaderProps {
type HeaderHierarchy = "primary" | "secondary";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it like this so that we can add additional variants over time

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For creating variants, I would recommend you to use class-variance-authority package. You can see how it is used in the Button component.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've used CVA before – I actually used it in the take-home that got me into Coder. I thought it was a bit too much overhead here, but if we're switching to CVA as a go-to, I can swap that in

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of shadcn, our base components are using CVA so I think it would be nice to use it but it is up to you.


type HeaderProps = Readonly<{
title: ReactNode;
description?: ReactNode;
secondary?: boolean;
hierarchy?: HeaderHierarchy;
docsHref?: string;
tooltip?: ReactNode;
}
}>;

export const SettingsHeader: FC<HeaderProps> = ({
title,
description,
docsHref,
secondary,
tooltip,
hierarchy = "primary",
}) => {
const theme = useTheme();

Expand All @@ -37,7 +39,7 @@ export const SettingsHeader: FC<HeaderProps> = ({
marginBottom: 4,
gap: 8,
},
secondary && {
hierarchy === "secondary" && {
fontSize: 24,
fontWeight: 500,
},
Expand All @@ -60,7 +62,6 @@ export const SettingsHeader: FC<HeaderProps> = ({
</span>
)}
</div>

{docsHref && (
<Button asChild variant="outline">
<a href={docsHref} target="_blank" rel="noreferrer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const NetworkSettingsPageView: FC<NetworkSettingsPageViewProps> = ({
<div>
<SettingsHeader
title="Port Forwarding"
secondary
hierarchy="secondary"
description="Port forwarding lets developers securely access processes on their Coder workspace from a local machine."
docsHref={docs("/admin/networking/port-forwarding")}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ObservabilitySettingsPageView: FC<
<SettingsHeader title="Observability" />
<SettingsHeader
title="Audit Logging"
secondary
hierarchy="secondary"
description="Allow auditors to monitor user operations in your deployment."
docsHref={docs("/admin/security/audit-logs")}
/>
Expand Down Expand Up @@ -64,7 +64,7 @@ export const ObservabilitySettingsPageView: FC<
<div>
<SettingsHeader
title="Monitoring"
secondary
hierarchy="secondary"
description="Monitoring your Coder application with logs and metrics."
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const SecuritySettingsPageView: FC<SecuritySettingsPageViewProps> = ({
<div>
<SettingsHeader
title="Browser Only Connections"
secondary
hierarchy="secondary"
description="Block all workspace access via SSH, port forward, and other non-browser connections."
docsHref={docs("/admin/networking#browser-only-connections")}
/>
Expand All @@ -64,7 +64,7 @@ export const SecuritySettingsPageView: FC<SecuritySettingsPageViewProps> = ({
<div>
<SettingsHeader
title="TLS"
secondary
hierarchy="secondary"
description="Ensure TLS is properly configured for your Coder deployment."
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const UserAuthSettingsPageView = ({

<SettingsHeader
title="Login with OpenID Connect"
secondary
hierarchy="secondary"
description="Set up authentication to login with OpenID Connect."
docsHref={docs("/admin/users/oidc-auth#openid-connect")}
/>
Expand All @@ -50,7 +50,7 @@ export const UserAuthSettingsPageView = ({
<div>
<SettingsHeader
title="Login with GitHub"
secondary
hierarchy="secondary"
description="Set up authentication to login with GitHub."
docsHref={docs("/admin/users/github-auth")}
/>
Expand Down