-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update backpagehero component to optionally render icon and by …
…line (#258)
- Loading branch information
Fran McDade
authored and
Fran McDade
committed
Jun 23, 2023
1 parent
14abee8
commit e01e372
Showing
3 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...nents/Layout/components/BackPage/components/BackPageHero/components/SubTitle/subTitle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Typography } from "@mui/material"; | ||
import React, { ReactNode } from "react"; | ||
import { TEXT_BODY_SMALL_400 } from "../../../../../../../../theme/common/typography"; | ||
|
||
export interface SubTitleProps { | ||
subTitle?: ReactNode; | ||
} | ||
|
||
export const SubTitle = ({ | ||
subTitle, | ||
...props /* Spread props to allow for Typography specific props TypographyProps e.g. "gutterBottom" or "noWrap". */ | ||
}: SubTitleProps): JSX.Element => { | ||
return ( | ||
<> | ||
{typeof subTitle === "string" ? ( | ||
<Typography color="ink.light" variant={TEXT_BODY_SMALL_400} {...props}> | ||
{subTitle} | ||
</Typography> | ||
) : ( | ||
subTitle | ||
)} | ||
</> | ||
); | ||
}; |
27 changes: 21 additions & 6 deletions
27
packages/data-explorer-ui/src/components/common/Title/title.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
import { Typography } from "@mui/material"; | ||
import React from "react"; | ||
import React, { ReactNode } from "react"; | ||
import { TEXT_HEADING_LARGE } from "../../../theme/common/typography"; | ||
|
||
export type HeroTitle = string; | ||
export type HeroTitle = ReactNode; | ||
|
||
export interface TitleProps { | ||
title: HeroTitle; | ||
} | ||
|
||
export const Title = ({ title }: TitleProps): JSX.Element => { | ||
export const Title = ({ | ||
title, | ||
...props /* Spread props to allow for Typography specific props TypographyProps e.g. "gutterBottom" or "noWrap". */ | ||
}: TitleProps): JSX.Element => { | ||
return ( | ||
<Typography color="ink.main" component="h1" variant="text-heading-large"> | ||
{title} | ||
</Typography> | ||
<> | ||
{typeof title === "string" ? ( | ||
<Typography | ||
color="ink.main" | ||
component="h1" | ||
variant={TEXT_HEADING_LARGE} | ||
{...props} | ||
> | ||
{title} | ||
</Typography> | ||
) : ( | ||
title | ||
)} | ||
</> | ||
); | ||
}; |