Custom Typography HOC wrapper for Ant#6062
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
318db87 to
2645ff4
Compare
0a533a6 to
279b1a2
Compare
279b1a2 to
653ab58
Compare
653ab58 to
1cf3ad0
Compare
1cf3ad0 to
6a20836
Compare
| <Flex justify="space-between"> | ||
| {typeof heading === "string" ? ( | ||
| <Heading | ||
| <Title |
There was a problem hiding this comment.
Since this component shows up in the Ant POC, I chose to migrate here. We'll save full migration for later
There was a problem hiding this comment.
Good choice for the migration! I did find that the page titles changed from bold to semibold.
I tried switching it to 700 and the page titles stay consistent, but then the H2s, H3s become heavier than we had before. IMO the titles look better with 600 font-weight, but we ask for design input.
There was a problem hiding this comment.
update: design said 600 font weight is good!
| <Content className="overflow-auto px-10 py-6"> | ||
| <PageHeader heading="Ant Design Proof of Concept" /> | ||
| <Row gutter={16}> | ||
| <Row gutter={16} className="mt-6"> |
There was a problem hiding this comment.
The header change made this necessary
| variant="borderless" | ||
| className="h-full" | ||
| > | ||
| <Typography> |
There was a problem hiding this comment.
Note that this creates an <article> container when rendered
lucanovera
left a comment
There was a problem hiding this comment.
Thanks for unblocking us with the typography issues. The changes look good, I appreciate the flexibility of overriding styles while keeping semantics the same.
I updated a couple uses of h5 that now should be h3's and added back the margin.
I also found that the title font weight changes from 700 to 600 while switching the page title from chakra to ant, let's ask for design feedback.
Other than that, all the code changes look good and found no other issues while testing so I'll leave my approve here. 🚀
| > | ||
| {title} | ||
| </Typography.Title> | ||
| <Typography.Title level={3}>{title}</Typography.Title> |
There was a problem hiding this comment.
I pushed this change to change the title level to 3 and removed unnecessary styles.
|
|
||
| import { NextBreadcrumb, NextBreadcrumbProps } from "./nav/NextBreadcrumb"; | ||
|
|
||
| const { Title } = Typography; |
There was a problem hiding this comment.
Ant uses this kind of destructuring in their examples, and it's nice using <Title> instead of Typography.Something every time you need to put a text.
But at the same time, do we want to have to add this line every single time we want to use a typography? Seems to me like the kind of thing that would get annoying after a while.
What do you think about exporting Title, Paragraph, Text, etc directly from fidesui? Can you see any downsides of doing that?
There was a problem hiding this comment.
I'd be in favor of this approach also, provided there isn't an issue with it I'm missing.
There was a problem hiding this comment.
Love the idea. I'll make that update
| <Flex justify="space-between"> | ||
| {typeof heading === "string" ? ( | ||
| <Heading | ||
| <Title |
There was a problem hiding this comment.
Good choice for the migration! I did find that the page titles changed from bold to semibold.
I tried switching it to 700 and the page titles stay consistent, but then the H2s, H3s become heavier than we had before. IMO the titles look better with 600 font-weight, but we ask for design input.
| data-testid="custom-fields-form" | ||
| > | ||
| <Typography.Title level={5}>Custom fields</Typography.Title> | ||
| <div className="mb-2"> |
There was a problem hiding this comment.
I added this change to bring this title down to a h3 and added the margin back.
| > | ||
| <div className="mb-4"> | ||
| <Typography.Title level={5}>Details</Typography.Title> | ||
| <div className="mb-2"> |
There was a problem hiding this comment.
I added this change to bring this title down to a h3 and added the margin back.
| fontSizeXL: 24, | ||
| fontSizeLG: 18, | ||
| fontSizeSM: 12, | ||
| titleMarginBottom: 0, |
There was a problem hiding this comment.
In case you want to test title font weights, the token is fontWeightStrong: 700,
| }: React.ComponentProps<typeof Typography.Paragraph> & | ||
| CustomTypographyTextProps) => ( | ||
| <Typography.Paragraph | ||
| role="paragraph" |
There was a problem hiding this comment.
@lucanovera @jpople I forgot to call this out before. There's no real way to change the rendered tag in the HOC, and on top of that, having it be a div was a choice made to better support the other variants like editable, etc. So instead of trying to wrangle all of that, I simply gave it the proper a11y role here and moved on.
There was a problem hiding this comment.
@gilluminate that's a good workaround for accessibility! With admin-ui we don't have to worry about SEO so I think this it okay.
There was a problem hiding this comment.
True! But also, what's good for a11y is good for SEO ;)
| @@ -1,4 +1,4 @@ | |||
| import { AntFlex as Flex, Heading } from "fidesui"; | |||
| import { AntFlex as Flex, AntTitle as Title } from "fidesui"; | |||
fides
|
||||||||||||||||||||||||||||
| Project |
fides
|
| Branch Review |
main
|
| Run status |
|
| Run duration | 00m 51s |
| Commit |
|
| Committer | Jason Gill |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
5
|
| View all changes introduced in this branch ↗︎ | |
Closes LJ-692
Description Of Changes
Introduces a new custom Typography HOC in FidesUI that wraps Ant Design's Typography component, adding support for custom text sizes and heading sizes.
Code Changes
CustomTypographyHOC in FidesUI with support for custom text sizes (sm, default, lg) and heading sizes (h1-h5)Steps to Confirm
Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works