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

refactor(field): migrate layout components to sanity ui - phase 1 #2546

Merged
merged 7 commits into from Jun 23, 2021

Conversation

vicmeow
Copy link
Contributor

@vicmeow vicmeow commented Jun 9, 2021

NOTE: Do not merge before AFTER the next release 👍

Description

First phase of migrating components in @sanity/field to sanity ui and styled-components.
These are smaller changes with minimal visual changes.

I did not touch the PopoverDialog in the change list yet, will do that in another phase.

What to review

Make sure that things still look ok visually in the changes panel. I've attached screenshots for an overview.

Error boundary

Before
old-error
After
new-error

Change list, tooltip, breadcrumbs

Before (left) and after (right)
Screenshot 2021-06-09 at 14 47 56

Notes for release

  • Migrated components in @sanity/field to Sanity UI and styled-components

@vercel
Copy link

vercel bot commented Jun 9, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

test-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/test-studio/CsTR96JLbKvs8Lrv5qCruDbN3bpo
✅ Preview: https://test-studio-git-chore-ch1237field-implement-sanity-ui.sanity.build

perf-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/perf-studio/6nu3kHtytq9CYzg4FUrpPGssf4hG
✅ Preview: https://perf-studio-git-chore-ch1237field-implement-sanity-ui.sanity.build

@vicmeow vicmeow self-assigned this Jun 9, 2021
@vicmeow vicmeow changed the title refactor(field): migrate smaller @sanity/field components to sanity ui and styled-components refactor(field): migrate layout components to sanity ui Jun 9, 2021
Copy link
Member

@mariuslundgard mariuslundgard left a comment

Choose a reason for hiding this comment

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

Really nice work here! I only have concerns about RevertIcon and ErrorOutlineIcon. The other ones are optional nitpicks and praise 🙌

packages/@sanity/field/src/diff/components/ChangeList.tsx Outdated Show resolved Hide resolved
packages/@sanity/field/src/diff/components/ChangeList.tsx Outdated Show resolved Hide resolved
The component responsible for showing the changes to this field has crashed.
</Text>
{help && (
<Text size={1} as="p">
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: I think it would look good to use muted on this Text. So the headline is a little darker than the copy below it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good thinking!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks kind of funny 🤔 Screenshot 2021-06-10 at 13 38 09

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, but let’s fix the theme (in another PR, as mentioned in catch-up)

}

interface DiffTooltipWithAnnotationsProps {
interface DiffTooltipWithAnnotationsProps extends TooltipProps {
Copy link
Member

Choose a reason for hiding this comment

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

Nice detail to extend the TooltipProps here 👍

backgroundColor: color.background,
color: color.text,
borderRadius: 'calc(23px / 2)',
}}
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick (perhaps for a separate PR): I believe we could make this more reusable by creating a styled component here. Something like:

const UserColoredCard = styled(Card)<{$color: {background: string, text: string}}>`
  --card-bg-color: ${props => props.$color.background};
  --card-fg-color: ${props => props.$color.text};
  --card-muted-fg-color: ${props => props.$color.text};
`

And using it like:

<UserColoredCard $color={color} style={{borderRadius: 'calc(23px / 2)'}}>
  ...
</UserColoredCard>

</Text>
</Box>
)}
<Text size={1} weight="semibold">
Copy link
Member

Choose a reason for hiding this comment

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

You did correct by converting font-weight: 600 to semibold, but actually medium would be best so the these headers look similar to the field headers in the form.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the field headers are also using semibold tho? 🤔

<Text as="label" htmlFor={inputId} weight="semibold" size={1}>

Copy link
Member

Choose a reason for hiding this comment

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

Ah true, then why do they look lighter ... 🤔

Copy link
Member

@mariuslundgard mariuslundgard left a comment

Choose a reason for hiding this comment

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

LGTM ✨

@vicmeow
Copy link
Contributor Author

vicmeow commented Jun 10, 2021

I figured it out! It was applied in another component (with strong)

@vicmeow
Copy link
Contributor Author

vicmeow commented Jun 11, 2021

Do not merge before AFTER the next release 👍

@vicmeow vicmeow force-pushed the chore/ch1237/field-implement-sanity-ui branch from f5c3179 to d3a4670 Compare June 22, 2021 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants