diff --git a/.changeset/famous-impalas-destroy.md b/.changeset/famous-impalas-destroy.md new file mode 100644 index 0000000000..ca38c60a16 --- /dev/null +++ b/.changeset/famous-impalas-destroy.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/next-ui': patch +--- + +Added info icon for Snackbar when severity is set to info diff --git a/.changeset/plenty-icons-cough.md b/.changeset/plenty-icons-cough.md new file mode 100644 index 0000000000..bf41885e6e --- /dev/null +++ b/.changeset/plenty-icons-cough.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/next-ui': patch +--- + +Added ‘disableBackdropClick’ prop to MessageSnackbar to allow page interaction without closing the snackbar diff --git a/.changeset/shiny-radios-cover.md b/.changeset/shiny-radios-cover.md new file mode 100644 index 0000000000..d334548f78 --- /dev/null +++ b/.changeset/shiny-radios-cover.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/next-ui': patch +--- + +Added DismissibleSnackbar component to allow messages to be shown only once diff --git a/.changeset/thirty-spiders-battle.md b/.changeset/thirty-spiders-battle.md new file mode 100644 index 0000000000..03ad7a1b92 --- /dev/null +++ b/.changeset/thirty-spiders-battle.md @@ -0,0 +1,6 @@ +--- +'@graphcommerce/magento-graphcms': patch +'@graphcommerce/next-ui': patch +--- + +Implemented Message variant for RowColumnOne to show an important message which, after dismissing, will not show again diff --git a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOne.graphql b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOne.graphql index baeba66324..bd122dd247 100644 --- a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOne.graphql +++ b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOne.graphql @@ -1,4 +1,6 @@ fragment RowColumnOne on RowColumnOne { + id + rowColumnOneVariant colOne { raw } diff --git a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOne.tsx b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOne.tsx index d170c36fbf..738b143683 100644 --- a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOne.tsx +++ b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/RowColumnOne.tsx @@ -1,17 +1,37 @@ -import { RichText, RichTextProps } from '@graphcommerce/graphcms-ui' -import { ColumnOne } from '@graphcommerce/next-ui' +import { RichTextProps } from '@graphcommerce/graphcms-ui' import type { RowColumnOneFragment } from './RowColumnOne.gql' +import { Default, Message } from './variant' + +type VariantRenderer = Record< + NonNullable, + React.VFC +> export type RowColumnOneProps = RowColumnOneFragment & { + renderer?: Partial richTextOne?: Omit } +const defaultRenderer: Partial = { + Default, + Message, +} + export function RowColumnOne(props: RowColumnOneProps) { - const { colOne, richTextOne } = props + const { renderer, ...RowColumnOneProps } = props + let { rowColumnOneVariant } = props + + const mergedRenderer = { ...defaultRenderer, ...renderer } as VariantRenderer + + if (!rowColumnOneVariant) rowColumnOneVariant = 'Default' + + const RenderType = + mergedRenderer?.[rowColumnOneVariant] ?? + (() => { + if (process.env.NODE_ENV !== 'production') + return <>renderer for {rowColumnOneVariant} not found + return null + }) - return ( - - - - ) + return } diff --git a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/variant/Default.tsx b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/variant/Default.tsx new file mode 100644 index 0000000000..36d419506b --- /dev/null +++ b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/variant/Default.tsx @@ -0,0 +1,17 @@ +import { RichText, RichTextProps } from '@graphcommerce/graphcms-ui' +import { ColumnOne } from '@graphcommerce/next-ui' +import type { RowColumnOneFragment } from '../RowColumnOne.gql' + +type RowColumnOneProps = RowColumnOneFragment & { + richTextOne?: Omit +} + +export function Default(props: RowColumnOneProps) { + const { colOne, richTextOne } = props + + return ( + + + + ) +} diff --git a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/variant/Message.tsx b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/variant/Message.tsx new file mode 100644 index 0000000000..4d03327457 --- /dev/null +++ b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/variant/Message.tsx @@ -0,0 +1,17 @@ +import { RichText, RichTextProps } from '@graphcommerce/graphcms-ui' +import { VariantMessage } from '@graphcommerce/next-ui' +import type { RowColumnOneFragment } from '../RowColumnOne.gql' + +type RowColumnOneProps = RowColumnOneFragment & { + richTextOne?: Omit +} + +export function Message(props: RowColumnOneProps) { + const { colOne, richTextOne, id } = props + + return ( + + + + ) +} diff --git a/examples/magento-graphcms/components/GraphCMS/RowColumnOne/variant/index.tsx b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/variant/index.tsx new file mode 100644 index 0000000000..24a3e580af --- /dev/null +++ b/examples/magento-graphcms/components/GraphCMS/RowColumnOne/variant/index.tsx @@ -0,0 +1,2 @@ +export * from './Default' +export * from './Message' diff --git a/packages/magento-compare/components/CompareMessageSnackbar.tsx b/packages/magento-compare/components/CompareMessageSnackbar.tsx index 01403e432e..0bb21c5a47 100644 --- a/packages/magento-compare/components/CompareMessageSnackbar.tsx +++ b/packages/magento-compare/components/CompareMessageSnackbar.tsx @@ -25,6 +25,7 @@ export function CompareMessageSnackbar(props: CompareMessageSnackbarProps) { setDisplayMessageBar(false) }} variant='pill' + severity='success' action={ count && count > 1 ? ( - + diff --git a/packages/magento-newsletter/components/GuestNewsletter/GuestNewsletter.tsx b/packages/magento-newsletter/components/GuestNewsletter/GuestNewsletter.tsx index 450e979662..acd7a0f754 100644 --- a/packages/magento-newsletter/components/GuestNewsletter/GuestNewsletter.tsx +++ b/packages/magento-newsletter/components/GuestNewsletter/GuestNewsletter.tsx @@ -54,6 +54,7 @@ export function GuestNewsletter(props: GuestNewsletterProps) { diff --git a/packages/magento-product-configurable/ConfigurableProductAddToCart/ConfigurableProductAddToCart.tsx b/packages/magento-product-configurable/ConfigurableProductAddToCart/ConfigurableProductAddToCart.tsx index c5d2a434d9..c1f16b23c6 100644 --- a/packages/magento-product-configurable/ConfigurableProductAddToCart/ConfigurableProductAddToCart.tsx +++ b/packages/magento-product-configurable/ConfigurableProductAddToCart/ConfigurableProductAddToCart.tsx @@ -159,6 +159,7 @@ export function ConfigurableProductAddToCart(props: ConfigurableProductAddToCart !data?.addProductsToCart?.user_errors?.length } variant='pill' + severity='success' autoHide action={