-
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
Add a TierIndicator component #2956
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 0517055 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: +8 B (0%) Total Size: 707 kB
ℹ️ View Unchanged
|
e526380
to
e5cd185
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2956 +/- ##
==========================================
+ Coverage 87.60% 87.61% +0.01%
==========================================
Files 228 229 +1
Lines 13058 13069 +11
Branches 1760 1761 +1
==========================================
+ Hits 11440 11451 +11
Misses 1561 1561
Partials 57 57
|
e5cd185
to
063aa2c
Compare
1d9b35c
to
58e93f4
Compare
58e93f4
to
efc628a
Compare
efc628a
to
5c06d0c
Compare
5c06d0c
to
521f341
Compare
7594e08
to
0517055
Compare
@@ -0,0 +1,5 @@ | |||
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="16" fill="none" viewBox="0 0 36 16"> | |||
<g clip-path="url(#plus_tier_16_svg__clip0_11228_178)"> |
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.
The referenced clip-path element doesn't exist, which makes me think it's not needed.
@@ -0,0 +1,5 @@ | |||
<svg xmlns="http://www.w3.org/2000/svg" width="63" height="32" fill="none" viewBox="0 0 63 32"> | |||
<g clip-path="url(#plus_tier_32_svg__clip0_11228_194)"> |
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.
Same as above.
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.
We'll need to remember to bump @sumup-oss/circuit-ui
's peer dependency range of @sumup-oss/icons
, since the TierIndicator component relies on the new icons.
|
||
import { TierIndicator } from './TierIndicator.js'; | ||
|
||
describe('TierIndicator', () => { |
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.
The test for a custom class name is missing.
/** | ||
* The tier name. | ||
*/ | ||
variant: 'Plus'; |
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.
variant: 'Plus'; | |
variant: 'plus'; |
*/ | ||
size?: 's' | 'm' | 'l'; | ||
} | ||
const sizeMap: Record<string, (typeof SIZES)[number]> = { |
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.
Why not simply:
const sizeMap: Record<string, (typeof SIZES)[number]> = { | |
const sizeMap: Record<string, '16' | '24' | '32'> = { |
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.
Alternatively you could remove the type and annotate it with as const
, which would also ensure that the keys match the size
prop.
variant: 'Plus'; | ||
/** | ||
* Choose from 3 sizes. | ||
* @default `m`. |
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.
* @default `m`. | |
* @default 'm'. |
}; | ||
|
||
export const TierIndicator = forwardRef<SVGSVGElement, TierIndicatorProps>( | ||
({ size = 'm', ...props }, ref) => ( |
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.
We need to filter out the variant
prop here since it's not a valid SVG attribute.
({ size = 'm', ...props }, ref) => ( | |
({ size = 'm', variant, ...props }, ref) => ( |
Addresses DSYS-955
Purpose
Create a new component to highlight features that are behind a paywall or provided by a certain tier.
Approach and changes
Create a TierIndicator component to highlight paid plans. For now, this component only accepts the "Plus" tier but can be extended in the future if necessary. The component is built by placing a Headline component in front an svg shape of the indicator, and comes in three sizes: s, m and l.
Definition of done