Skip to content

Commit 3e0d9ca

Browse files
committed
Adding typography components
1 parent e4e0514 commit 3e0d9ca

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

components/dashboard/src/components/Header.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useEffect } from "react";
88
import { useLocation } from "react-router";
99
import { Separator } from "./Separator";
1010
import TabMenuItem from "./TabMenuItem";
11+
import { Heading1, Subheading } from "./typography/headings";
1112

1213
export interface HeaderProps {
1314
title: string | React.ReactElement;
@@ -33,8 +34,12 @@ export default function Header(p: HeaderProps) {
3334
<div className="app-container border-gray-200 dark:border-gray-800">
3435
<div className="flex pb-8 pt-6">
3536
<div className="">
36-
{typeof p.title === "string" ? <h1 className="tracking-tight">{p.title}</h1> : p.title}
37-
{typeof p.subtitle === "string" ? <h2 className="tracking-wide">{p.subtitle}</h2> : p.subtitle}
37+
{typeof p.title === "string" ? <Heading1>{p.title}</Heading1> : p.title}
38+
{typeof p.subtitle === "string" ? (
39+
<Subheading className="tracking-wide">{p.subtitle}</Subheading>
40+
) : (
41+
p.subtitle
42+
)}
3843
</div>
3944
</div>
4045
<nav className="flex">
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Copyright (c) 2023 Gitpod GmbH. All rights reserved.
3+
* Licensed under the GNU Affero General Public License (AGPL).
4+
* See License.AGPL.txt in the project root for license information.
5+
*/
6+
7+
import classNames from "classnames";
8+
import { FC } from "react";
9+
10+
type HeadingProps = {
11+
className?: string;
12+
};
13+
14+
export const Heading1: FC<HeadingProps> = ({ className, children }) => {
15+
return <h1 className={classNames("text-gray-900 dark:text-gray-100 font-bold text-4xl", className)}>{children}</h1>;
16+
};
17+
18+
// Intended to be placed beneath a heading to provide more context
19+
export const Subheading: FC<HeadingProps> = ({ className, children }) => {
20+
return <p className={classNames("text-base text-gray-500 dark:text-gray-600", className)}>{children}</p>;
21+
};

0 commit comments

Comments
 (0)