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

Add new pricing options component #530

Merged
merged 40 commits into from
Mar 22, 2024
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d129011
Add new pricing cards component
danielguillan Feb 1, 2024
d44ad9d
Add default story
danielguillan Feb 22, 2024
a80bd83
github-actions[bot] Regenerated snapshots
danielguillan Feb 22, 2024
f26a4ed
CSS cleanup
danielguillan Feb 22, 2024
f23b8fd
Add documentation
danielguillan Feb 27, 2024
a156489
Add card and default layout options
danielguillan Feb 28, 2024
ae6d6a4
Update stories and docs
danielguillan Feb 29, 2024
f584fac
Add changeset
danielguillan Feb 29, 2024
0d29f7e
github-actions[bot] Regenerated snapshots
danielguillan Feb 29, 2024
787f66f
Add tests
danielguillan Mar 4, 2024
fdd89cd
Add component design tokens
danielguillan Mar 5, 2024
a58705c
Add missing tokens file
danielguillan Mar 5, 2024
eaf3ff2
Set testids on subcomponents
danielguillan Mar 5, 2024
af42e42
Fixes
danielguillan Mar 6, 2024
101fefb
Merge branch 'main' of github.com:primer/brand into danielguillan/add…
danielguillan Mar 6, 2024
ac3a090
Update components with animation list
danielguillan Mar 6, 2024
a2c48c9
Fix story
danielguillan Mar 6, 2024
ccacca2
Update price format with currency code
danielguillan Mar 8, 2024
7314dab
Add support for React children in Accordion heading
danielguillan Mar 11, 2024
bc6dd69
Make feature list collapsible on small viewports
danielguillan Mar 11, 2024
b5668e1
Rename component to PricingOptions
danielguillan Mar 11, 2024
7e5f1b7
github-actions[bot] Regenerated snapshots
danielguillan Mar 11, 2024
3767e28
Rename missing instances of pricing card
danielguillan Mar 11, 2024
16ee9b9
Remove root and item element semantics and animation
danielguillan Mar 18, 2024
af754a5
Update apps/docs/content/components/PricingOptions.mdx
danielguillan Mar 20, 2024
101acd9
Update apps/docs/content/components/PricingOptions.mdx
danielguillan Mar 20, 2024
1845463
Update packages/react/src/PricingOptions/PricingOptions.module.css
danielguillan Mar 20, 2024
2df1539
Update apps/docs/content/components/PricingOptions.mdx
danielguillan Mar 21, 2024
a194db7
Update apps/docs/content/components/PricingOptions.mdx
danielguillan Mar 21, 2024
8ab5fac
Apply suggestions from @rezrah
danielguillan Mar 21, 2024
9e68edf
Apply feedback
danielguillan Mar 21, 2024
243da01
Merge branch 'main' of github.com:primer/brand into danielguillan/add…
danielguillan Mar 21, 2024
d30ac85
Fixes
danielguillan Mar 21, 2024
7bbd946
Fix docs
danielguillan Mar 21, 2024
e798dca
Rename presentation prop to variant, other fixes
danielguillan Mar 21, 2024
90b7b69
Rename remaining instances of pricing cards, cleanup tokens
danielguillan Mar 21, 2024
e1950af
Enforce limit of 3 items
danielguillan Mar 21, 2024
7659c28
Memoize Item children
danielguillan Mar 21, 2024
f176f06
CSS fixes
danielguillan Mar 21, 2024
919fd01
Update stories accent color
danielguillan Mar 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from @rezrah
Co-authored-by: Rez <13340707+rezrah@users.noreply.github.com>
danielguillan and rezrah authored Mar 21, 2024
commit 8ab5fac621fd0292c7a7a5335df69a53cc945162
5 changes: 2 additions & 3 deletions apps/docs/content/components/PricingOptions.mdx
Original file line number Diff line number Diff line change
@@ -677,7 +677,7 @@ Use `PricingOptions.FeatureListItem` with `variant="included"` and `variant="exc
| :------------- | :-------------------- | :-------: | :------: | :---------------------------------- |
| `as` | <PropTableValues values={[`section`, `div` ]} addLineBreaks /> | `section` | `false` | Applies the underlying HTML element |
| `children` | `PricingOptions.Item` | | `true` | Applies the underlying HTML element |
| `presentation` | `default, cards` | | `false` | The presentation styling |
| `presentation` | <PropTableValues values={[`default`, `cards` ]} addLineBreaks /> | | `false` | The presentation styling |

### PricingOptions.Item <Label>Required</Label>

@@ -704,7 +704,7 @@ One item per pricing plan to be displayed. Maximum of 3 items.

| Name | Type | Default | required | Description |
| :--------- | :---------- | :---------: | :------: | :------------------------- |
| `children` | `ReactNode` | `undefined` | `true` | The desciption of the item |
| `children` | `ReactNode` | `undefined` | `true` | The description of the item |

### PricingOptions.Price

@@ -741,4 +741,3 @@ One item per pricing plan to be displayed. Maximum of 3 items.
| :--------- | :---------- | :---------: | :------: | :----------------------- |
| `children` | `ReactNode` | `undefined` | `true` | The footnote of the item |

x
6 changes: 3 additions & 3 deletions packages/react/src/PricingOptions/PricingOptions.tsx
Original file line number Diff line number Diff line change
@@ -57,9 +57,9 @@ const PricingOptionsRoot = forwardRef(
}: PropsWithChildren<PricingOptionsProps>,
ref: Ref<HTMLDivElement>,
) => {
const filteredChildren = React.Children.toArray(children).filter(
const filteredChildren = React.useMemo(React.Children.toArray(children).filter(
child => React.isValidElement(child) && typeof child.type !== 'string' && child.type === PricingOptionsItem,
)
), [children])

return (
<div
@@ -290,7 +290,7 @@ const PricingOptionsFeatureList = forwardRef<HTMLDivElement, PricingOptionsFeatu
return acc
}, [])

const FeautreListItems = FilteredChidlrenSets.map(({Heading: HeadingChild, Items}, index) => (
const FeatureListItems = FilteredChildrenSets.map(({Heading: HeadingChild, Items}, index) => (
<div className={styles['PricingOptions__feature-list-set']} key={index}>
{HeadingChild}