-
Notifications
You must be signed in to change notification settings - Fork 129
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
Migrate grid components to TypeScript #1504
Conversation
🦋 Changeset detectedLatest commit: e3af387 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/sumup/oss-circuit-ui/4zY8hxSpjWWoM9JbMiWDZFBjsheQ |
Codecov Report
@@ Coverage Diff @@
## main #1504 +/- ##
==========================================
+ Coverage 92.33% 92.44% +0.11%
==========================================
Files 202 202
Lines 4213 4210 -3
Branches 1351 1353 +2
==========================================
+ Hits 3890 3892 +2
+ Misses 303 298 -5
Partials 20 20
|
6c9d30f
to
6d4f33b
Compare
6d4f33b
to
927d91b
Compare
max-width: 880px; | ||
padding-left: calc(16px / 2); | ||
padding-right: calc(16px / 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addition to the default styles is caused by the consistent use of composeBreakpoints
in all grid components. It has no effect since it's overridden by the breakpoint styles below which have higher specificity.
margin-left: calc(-16px / 2); | ||
margin-right: calc(-16px / 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addition to the default styles is caused by the consistent use of composeBreakpoints
in all grid components. It has no effect since it's overridden by the breakpoint styles below which have higher specificity.
import type { Theme } from '@sumup/design-tokens'; | ||
import type { SerializedStyles } from '@emotion/react'; | ||
import { css } from '@emotion/react'; | ||
import { entries } from 'lodash/fp'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This remaining lodash
method is required for compatibility with IE11 and can be removed in v5.
8281a68
to
e3af387
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Looks good to me, GitHub didn't show a super useful diff because of the file renaming but I trust Chromatic and our unit tests 👍
Addresses #516.
Purpose
When I started to remove the use of
lodash
in Circuit UI, I quickly found that it was used most heavily in the grid components. The current implementation is quite complicated, so I didn't feel comfortable refactoring it without the safety of types.Approach and changes
Grid
,Row
, andCol
) into a single folder and migrate them to TypeScriptlodash
methods, and to be used consistently across all grid componentsℹ️ API change: The
Col
component'sspan
andskip
props now accept numbers or numeric strings, even when nested in a breakpoints object. Here are some examples:Previously, a simple value would have to be a numeric string, while a breakpoint object value would work with either. Since this is an extension of the API, it is not a breaking change.
Definition of done