From 9bd2045200f64c5c1569d7ba987b5b33b75969be Mon Sep 17 00:00:00 2001 From: ss-dimasm Date: Fri, 27 Dec 2024 09:51:52 +0700 Subject: [PATCH 1/5] chore: #244 deprecating current status indicator --- .../__styles__/index.ts | 12 +++- .../status-indicator.test.tsx.snap | 65 +++++++++++++++++++ .../__tests__/status-indicator.test.tsx | 20 +++--- .../index.ts | 0 .../status-indicator.mdx | 45 +++++++++++++ .../status-indicator.stories.tsx | 22 +++---- .../status-indicator.tsx | 29 +++++++++ .../deprecated-table/table.stories.tsx | 14 ++-- .../status-indicator.test.tsx.snap | 65 ------------------- .../status-indicator/status-indicator.mdx | 45 ------------- .../status-indicator/status-indicator.tsx | 16 ----- src/index.ts | 2 +- 12 files changed, 177 insertions(+), 158 deletions(-) rename src/components/{status-indicator => deprecated-status-indicator}/__styles__/index.ts (90%) create mode 100644 src/components/deprecated-status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap rename src/components/{status-indicator => deprecated-status-indicator}/__tests__/status-indicator.test.tsx (54%) rename src/components/{status-indicator => deprecated-status-indicator}/index.ts (100%) create mode 100644 src/components/deprecated-status-indicator/status-indicator.mdx rename src/components/{status-indicator => deprecated-status-indicator}/status-indicator.stories.tsx (65%) create mode 100644 src/components/deprecated-status-indicator/status-indicator.tsx delete mode 100644 src/components/status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap delete mode 100644 src/components/status-indicator/status-indicator.mdx delete mode 100644 src/components/status-indicator/status-indicator.tsx diff --git a/src/components/status-indicator/__styles__/index.ts b/src/components/deprecated-status-indicator/__styles__/index.ts similarity index 90% rename from src/components/status-indicator/__styles__/index.ts rename to src/components/deprecated-status-indicator/__styles__/index.ts index 0bd61334..228946e6 100644 --- a/src/components/status-indicator/__styles__/index.ts +++ b/src/components/deprecated-status-indicator/__styles__/index.ts @@ -10,9 +10,15 @@ import { elIntentNeutral, } from '../../../styles/intent' -export const elShapeTag = css`` +/** + * @deprecated + */ +export const elDeprecatedShapeTag = css`` -export const ElStatusIndicator = styled.span` +/** + * @deprecated + */ +export const ElDeprecatedStatusIndicator = styled.span` border-radius: 3rem; display: inline-block; width: 0.75rem; @@ -56,7 +62,7 @@ export const ElStatusIndicator = styled.span` outline-color: var(--intent-default-dark); } - &.${elShapeTag} { + &.${elDeprecatedShapeTag} { border-radius: 1rem 0.2rem 0.2rem 1rem; height: 2rem; width: 0.5rem; diff --git a/src/components/deprecated-status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap b/src/components/deprecated-status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap new file mode 100644 index 00000000..fc3a87bb --- /dev/null +++ b/src/components/deprecated-status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap @@ -0,0 +1,65 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`DeprecatedStatusIndicator component > should match a snapshot 1`] = ` + + + +`; + +exports[`DeprecatedStatusIndicator component > should match a snapshot 2`] = ` + + + +`; + +exports[`DeprecatedStatusIndicator component > should match a snapshot 3`] = ` + + + +`; + +exports[`DeprecatedStatusIndicator component > should match a snapshot 4`] = ` + + + +`; + +exports[`DeprecatedStatusIndicator component > should match a snapshot 5`] = ` + + + +`; + +exports[`DeprecatedStatusIndicator component > should match a snapshot 6`] = ` + + + +`; + +exports[`DeprecatedStatusIndicator component > should match a snapshot 7`] = ` + + + +`; + +exports[`DeprecatedStatusIndicator component > should match a snapshot 8`] = ` + + + +`; diff --git a/src/components/status-indicator/__tests__/status-indicator.test.tsx b/src/components/deprecated-status-indicator/__tests__/status-indicator.test.tsx similarity index 54% rename from src/components/status-indicator/__tests__/status-indicator.test.tsx rename to src/components/deprecated-status-indicator/__tests__/status-indicator.test.tsx index 0da87743..6d22aa9a 100644 --- a/src/components/status-indicator/__tests__/status-indicator.test.tsx +++ b/src/components/deprecated-status-indicator/__tests__/status-indicator.test.tsx @@ -1,44 +1,44 @@ import { render } from '@testing-library/react' -import { StatusIndicator } from '..' +import { DeprecatedStatusIndicator } from '..' -describe('StatusIndicator component', () => { +describe('DeprecatedStatusIndicator component', () => { it('should match a snapshot', () => { - const wrapper = render() + const wrapper = render() expect(wrapper.asFragment()).toMatchSnapshot() }) it('should match a snapshot', () => { - const wrapper = render() + const wrapper = render() expect(wrapper.asFragment()).toMatchSnapshot() }) it('should match a snapshot', () => { - const wrapper = render() + const wrapper = render() expect(wrapper.asFragment()).toMatchSnapshot() }) it('should match a snapshot', () => { - const wrapper = render() + const wrapper = render() expect(wrapper.asFragment()).toMatchSnapshot() }) it('should match a snapshot', () => { - const wrapper = render() + const wrapper = render() expect(wrapper.asFragment()).toMatchSnapshot() }) it('should match a snapshot', () => { - const wrapper = render() + const wrapper = render() expect(wrapper.asFragment()).toMatchSnapshot() }) it('should match a snapshot', () => { - const wrapper = render() + const wrapper = render() expect(wrapper.asFragment()).toMatchSnapshot() }) it('should match a snapshot', () => { - const wrapper = render() + const wrapper = render() expect(wrapper.asFragment()).toMatchSnapshot() }) }) diff --git a/src/components/status-indicator/index.ts b/src/components/deprecated-status-indicator/index.ts similarity index 100% rename from src/components/status-indicator/index.ts rename to src/components/deprecated-status-indicator/index.ts diff --git a/src/components/deprecated-status-indicator/status-indicator.mdx b/src/components/deprecated-status-indicator/status-indicator.mdx new file mode 100644 index 00000000..160f543b --- /dev/null +++ b/src/components/deprecated-status-indicator/status-indicator.mdx @@ -0,0 +1,45 @@ +import { Meta, Story, Canvas, Controls } from '@storybook/blocks' +import { DeprecatedStatusIndicator } from '.' +import { RenderHtmlMarkup } from '../../storybook/render-html-markup' +import * as DeprecatedStatusIndicatorStories from './status-indicator.stories' + + + +# Deprecated Status Indicator + +A small coloured circle indicator to provide quick visual reference to the status of something; be it an action, response or anything else. + +Props available for the React version of the component; + + + +## Basic usage + + + + + +## Intent + +Different intents are supported, to enable buttons to be used in different contexts + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/status-indicator/status-indicator.stories.tsx b/src/components/deprecated-status-indicator/status-indicator.stories.tsx similarity index 65% rename from src/components/status-indicator/status-indicator.stories.tsx rename to src/components/deprecated-status-indicator/status-indicator.stories.tsx index 5a683eb7..e9365e99 100644 --- a/src/components/status-indicator/status-indicator.stories.tsx +++ b/src/components/deprecated-status-indicator/status-indicator.stories.tsx @@ -1,14 +1,14 @@ -import { StatusIndicator } from '.' +import { DeprecatedStatusIndicator } from '.' export default { - title: 'StatusIndicator', - component: StatusIndicator, + title: 'DeprecatedStatusIndicator', + component: DeprecatedStatusIndicator, } export const BasicUsage = { render: ({}) => (
- + Something is happening
), @@ -19,7 +19,7 @@ export const BasicUsage = { export const IntentPrimary = { render: ({}) => (
- + Primary
), @@ -30,7 +30,7 @@ export const IntentPrimary = { export const IntentNeutral = { render: ({}) => (
- + Neutral
), @@ -41,7 +41,7 @@ export const IntentNeutral = { export const IntentSuccess = { render: ({}) => (
- + Success
), @@ -52,7 +52,7 @@ export const IntentSuccess = { export const IntentPending = { render: ({}) => (
- + Pending
), @@ -63,7 +63,7 @@ export const IntentPending = { export const IntentWarning = { render: ({}) => (
- + Warning
), @@ -74,7 +74,7 @@ export const IntentWarning = { export const IntentDanger = { render: ({}) => (
- + Danger
), @@ -85,7 +85,7 @@ export const IntentDanger = { export const IntentDefault = { render: ({}) => (
- + Default
), diff --git a/src/components/deprecated-status-indicator/status-indicator.tsx b/src/components/deprecated-status-indicator/status-indicator.tsx new file mode 100644 index 00000000..82a9c96d --- /dev/null +++ b/src/components/deprecated-status-indicator/status-indicator.tsx @@ -0,0 +1,29 @@ +import React, { FC, HTMLAttributes } from 'react' +import { cx } from '@linaria/core' +import { elDeprecatedShapeTag, ElDeprecatedStatusIndicator } from './__styles__' +import { Intent, getIntentClassName } from '../../helpers/intent' + +/** + * replaced with StatusIndicatorProps + * @deprecated + */ +export interface DeprecatedStatusIndicatorProps extends HTMLAttributes { + intent?: Intent + shape?: 'circle' | 'tag' +} + +/** + * replaced with StatusIndicator + * @deprecated + */ +export const DeprecatedStatusIndicator: FC = ({ + intent = 'primary', + shape, + className, + ...rest +}) => ( + +) diff --git a/src/components/deprecated-table/table.stories.tsx b/src/components/deprecated-table/table.stories.tsx index 3177f352..de70da2f 100644 --- a/src/components/deprecated-table/table.stories.tsx +++ b/src/components/deprecated-table/table.stories.tsx @@ -15,7 +15,7 @@ import { Icon } from '../icon' import { elSpan2, elSpan3 } from '../grid' import { InputGroup } from '../input-group' import { Button, DeprecatedButtonGroup } from '../button' -import { StatusIndicator } from '../status-indicator' +import { DeprecatedStatusIndicator } from '../deprecated-status-indicator' import { elMlAuto } from '../../styles/spacing' import { FormLayout, InputWrap } from '../form-layout' import { elIsActive } from '../../styles/states' @@ -152,7 +152,7 @@ export const BasicCustomisationTableCells = { £50.00 - + Pending @@ -191,7 +191,7 @@ export const ExpandingTableCellSpace = { £50.00 - + Pending @@ -234,7 +234,7 @@ export const ExpandableContent = { £50.00 - + Pending @@ -293,7 +293,7 @@ export const CallToActionContent = { £50.00 - + Pending @@ -400,7 +400,7 @@ export const ReactShorthandUsage = { children: ( <> - + Pending ), @@ -532,7 +532,7 @@ export const AdvancedCustomisationReact = { children: ( <> - + Pending ), diff --git a/src/components/status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap b/src/components/status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap deleted file mode 100644 index ecbfaece..00000000 --- a/src/components/status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap +++ /dev/null @@ -1,65 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`StatusIndicator component > should match a snapshot 1`] = ` - - - -`; - -exports[`StatusIndicator component > should match a snapshot 2`] = ` - - - -`; - -exports[`StatusIndicator component > should match a snapshot 3`] = ` - - - -`; - -exports[`StatusIndicator component > should match a snapshot 4`] = ` - - - -`; - -exports[`StatusIndicator component > should match a snapshot 5`] = ` - - - -`; - -exports[`StatusIndicator component > should match a snapshot 6`] = ` - - - -`; - -exports[`StatusIndicator component > should match a snapshot 7`] = ` - - - -`; - -exports[`StatusIndicator component > should match a snapshot 8`] = ` - - - -`; diff --git a/src/components/status-indicator/status-indicator.mdx b/src/components/status-indicator/status-indicator.mdx deleted file mode 100644 index 52f9e153..00000000 --- a/src/components/status-indicator/status-indicator.mdx +++ /dev/null @@ -1,45 +0,0 @@ -import { Meta, Story, Canvas, Controls } from '@storybook/blocks' -import { StatusIndicator } from '.' -import { RenderHtmlMarkup } from '../../storybook/render-html-markup' -import * as StatusIndicatorStories from './status-indicator.stories' - - - -# Status Indicator - -A small coloured circle indicator to provide quick visual reference to the status of something; be it an action, response or anything else. - -Props available for the React version of the component; - - - -## Basic usage - - - - - -## Intent - -Different intents are supported, to enable buttons to be used in different contexts - - - - - - - - - - - - - - - - - - - - - diff --git a/src/components/status-indicator/status-indicator.tsx b/src/components/status-indicator/status-indicator.tsx deleted file mode 100644 index 511bd2f3..00000000 --- a/src/components/status-indicator/status-indicator.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React, { FC, HTMLAttributes } from 'react' -import { cx } from '@linaria/core' -import { elShapeTag, ElStatusIndicator } from './__styles__' -import { Intent, getIntentClassName } from '../../helpers/intent' - -export interface StatusIndicatorProps extends HTMLAttributes { - intent?: Intent - shape?: 'circle' | 'tag' -} - -export const StatusIndicator: FC = ({ intent = 'primary', shape, className, ...rest }) => ( - -) diff --git a/src/index.ts b/src/index.ts index 7993408d..a73f0378 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,7 +30,7 @@ export * from './components/secondary-nav' export * from './components/select' export * from './components/searchable-dropdown' export * from './components/snack' -export * from './components/status-indicator' +export * from './components/deprecated-status-indicator' export * from './components/steps' export * from './components/deprecated-table' export * from './components/tabs' From 94892361e93a566d3760c72ee73481502a5ca6b1 Mon Sep 17 00:00:00 2001 From: ss-dimasm Date: Fri, 27 Dec 2024 10:57:58 +0700 Subject: [PATCH 2/5] feat: #244 add new status indicator component --- .../status-indicator.test.tsx.snap | 113 ++++++++++++++++++ .../__tests__/status-indicator.test.tsx | 15 +++ .../status-indicator/status-indicator.mdx | 23 ++++ .../status-indicator.stories.tsx | 41 +++++++ .../status-indicator/status-indicator.tsx | 35 ++++++ src/components/status-indicator/styles.ts | 53 ++++++++ 6 files changed, 280 insertions(+) create mode 100644 src/components/status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap create mode 100644 src/components/status-indicator/__tests__/status-indicator.test.tsx create mode 100644 src/components/status-indicator/status-indicator.mdx create mode 100644 src/components/status-indicator/status-indicator.stories.tsx create mode 100644 src/components/status-indicator/status-indicator.tsx create mode 100644 src/components/status-indicator/styles.ts diff --git a/src/components/status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap b/src/components/status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap new file mode 100644 index 00000000..a1633038 --- /dev/null +++ b/src/components/status-indicator/__tests__/__snapshots__/status-indicator.test.tsx.snap @@ -0,0 +1,113 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`StatusIndicator > should render as expected 1`] = ` + +
+ + Neutral +
+
+`; + +exports[`StatusIndicator > should render as expected 2`] = ` + +
+ + Success +
+
+`; + +exports[`StatusIndicator > should render as expected 3`] = ` + +
+ + Warning +
+
+`; + +exports[`StatusIndicator > should render as expected 4`] = ` + +
+ + Pending +
+
+`; + +exports[`StatusIndicator > should render as expected 5`] = ` + +
+ + Danger +
+
+`; + +exports[`StatusIndicator > should render as expected 6`] = ` + +
+ + Inactive +
+
+`; + +exports[`StatusIndicator > should render as expected 7`] = ` + +
+ + Accent 1 +
+
+`; + +exports[`StatusIndicator > should render as expected 8`] = ` + +
+ + Accent 2 +
+
+`; diff --git a/src/components/status-indicator/__tests__/status-indicator.test.tsx b/src/components/status-indicator/__tests__/status-indicator.test.tsx new file mode 100644 index 00000000..e322b27b --- /dev/null +++ b/src/components/status-indicator/__tests__/status-indicator.test.tsx @@ -0,0 +1,15 @@ +import { render } from '@testing-library/react' +import { StatusIndicator } from '../status-indicator' + +describe('StatusIndicator', () => { + it('should render as expected', () => { + expect(render(Neutral).asFragment()).toMatchSnapshot() + expect(render(Success).asFragment()).toMatchSnapshot() + expect(render(Warning).asFragment()).toMatchSnapshot() + expect(render(Pending).asFragment()).toMatchSnapshot() + expect(render(Danger).asFragment()).toMatchSnapshot() + expect(render(Inactive).asFragment()).toMatchSnapshot() + expect(render(Accent 1).asFragment()).toMatchSnapshot() + expect(render(Accent 2).asFragment()).toMatchSnapshot() + }) +}) diff --git a/src/components/status-indicator/status-indicator.mdx b/src/components/status-indicator/status-indicator.mdx new file mode 100644 index 00000000..a066b33e --- /dev/null +++ b/src/components/status-indicator/status-indicator.mdx @@ -0,0 +1,23 @@ +import { Meta, Canvas, Controls } from '@storybook/blocks' +import { RenderHtmlMarkup } from '../../storybook/render-html-markup' +import * as StatusIndicatorStories from './status-indicator.stories' + + + +# Status Indicator + +A Status Indicator is a low-visibility component used to highlight important information. + + + +## Default + + + + + +## Variants + + + + diff --git a/src/components/status-indicator/status-indicator.stories.tsx b/src/components/status-indicator/status-indicator.stories.tsx new file mode 100644 index 00000000..6306df46 --- /dev/null +++ b/src/components/status-indicator/status-indicator.stories.tsx @@ -0,0 +1,41 @@ +import { Meta } from '@storybook/react' +import { StatusIndicator } from './status-indicator' +import { FlexContainer } from '../layout' + +const meta = { + title: 'Components/Status Indicator', + component: StatusIndicator, + argTypes: { + variant: { + control: 'select', + options: ['neutral', 'success', 'pending', 'warning', 'danger', 'accent1', 'accent2'], + description: 'Defines the status indicator style variant.', + }, + className: { + control: 'text', + description: 'CSS class for additional styling', + }, + }, +} satisfies Meta + +export default meta + +export const Default = { + args: { + children: 'Status Indicator', + }, +} + +export const Variants = { + render: ({}) => ( + + Neutral + Success + Pending + Warning + Danger + Accent 1 + Accent 2 + + ), +} diff --git a/src/components/status-indicator/status-indicator.tsx b/src/components/status-indicator/status-indicator.tsx new file mode 100644 index 00000000..786da03e --- /dev/null +++ b/src/components/status-indicator/status-indicator.tsx @@ -0,0 +1,35 @@ +import { FC, HTMLAttributes, ReactNode } from 'react' +import { ElStatusIndicator, ElStatusIndicatorShape } from './styles' + +export type StatusIndicatorVariant = + | 'neutral' + | 'success' + | 'pending' + | 'warning' + | 'danger' + | 'inactive' + | 'accent1' + | 'accent2' + +export interface StatusIndicatorProps extends HTMLAttributes { + /** + * The variant of the status indicator, used to highlight important information + * + * @default "neutral" + */ + variant?: StatusIndicatorVariant + + /** + * The related content associated with the status indicator variant + */ + children: ReactNode +} + +export const StatusIndicator: FC = ({ variant = 'neutral', children, ...rest }) => { + return ( + + + {children} + + ) +} diff --git a/src/components/status-indicator/styles.ts b/src/components/status-indicator/styles.ts new file mode 100644 index 00000000..4eb6fcfd --- /dev/null +++ b/src/components/status-indicator/styles.ts @@ -0,0 +1,53 @@ +import { styled } from '@linaria/react' + +export const ElStatusIndicatorShape = styled.span` + width: var(--size-2); + height: var(--size-2); + border-radius: 100%; + + &[data-variant='neutral'] { + background: var(--icon-info); + } + + &[data-variant='success'] { + background: var(--icon-success); + } + + &[data-variant='pending'] { + background: var(--icon-pending); + } + + &[data-variant='warning'] { + background: var(--icon-warning); + } + + &[data-variant='danger'] { + background: var(--icon-error); + } + + &[data-variant='inactive'] { + background: var(--icon-secondary); + } + + &[data-variant='accent1'] { + background: var(--icon-accent_1); + } + + &[data-variant='accent2'] { + background: var(--icon-accent_2); + } +` + +export const ElStatusIndicator = styled.div` + display: flex; + align-items: center; + gap: var(--spacing-2); + + color: var(--text-primary); + font-family: var(--font-family); + font-size: var(--font-size-sm); + font-style: normal; + font-weight: 400; + line-height: var(--line-height-sm); + letter-spacing: var(--letter-spacing-sm); +` From 4028791ff8941acd28fcd2cac79eb891550ca867 Mon Sep 17 00:00:00 2001 From: ss-dimasm Date: Fri, 27 Dec 2024 11:02:44 +0700 Subject: [PATCH 3/5] chore: add inactive in variants story --- src/components/status-indicator/status-indicator.stories.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/status-indicator/status-indicator.stories.tsx b/src/components/status-indicator/status-indicator.stories.tsx index 6306df46..f0bcd495 100644 --- a/src/components/status-indicator/status-indicator.stories.tsx +++ b/src/components/status-indicator/status-indicator.stories.tsx @@ -8,7 +8,7 @@ const meta = { argTypes: { variant: { control: 'select', - options: ['neutral', 'success', 'pending', 'warning', 'danger', 'accent1', 'accent2'], + options: ['neutral', 'success', 'pending', 'warning', 'danger', 'inactive', 'accent1', 'accent2'], description: 'Defines the status indicator style variant.', }, className: { @@ -34,6 +34,7 @@ export const Variants = { Pending Warning Danger + Neutral Accent 1 Accent 2 From 20515f03be121007e7d13838ee5f3ebcb23822bf Mon Sep 17 00:00:00 2001 From: ss-dimasm Date: Thu, 16 Jan 2025 16:15:28 +0700 Subject: [PATCH 4/5] Merge branch with main into feat/#244-new-status-indicator --- src/components/avatar/styles.ts | 2 +- .../__snapshots__/badge.test.tsx.snap | 114 ------------------ src/components/badge/__tests__/badge.test.tsx | 56 --------- src/components/badge/badge.stories.tsx | 28 ----- src/components/badge/badge.tsx | 20 --- src/components/button/button.mdx | 8 ++ src/components/button/button.stories.tsx | 38 +++++- src/components/button/button.tsx | 110 +++++++++-------- src/components/button/styles.ts | 24 ++-- .../__styles__/index.ts | 9 +- .../__snapshots__/badge.test.tsx.snap | 114 ++++++++++++++++++ .../deprecated-badge/__tests__/badge.test.tsx | 56 +++++++++ .../{badge => deprecated-badge}/badge.mdx | 3 +- .../deprecated-badge/badge.stories.tsx | 28 +++++ src/components/deprecated-badge/badge.tsx | 23 ++++ .../{badge => deprecated-badge}/index.ts | 0 .../__styles__/index.ts | 9 +- .../__tests__/__snapshots__/tag.test.tsx.snap | 24 ++-- .../__tests__/tag.test.tsx | 26 ++-- .../{tag => deprecated-tag}/index.ts | 0 .../{tag => deprecated-tag}/tag.mdx | 2 +- .../{tag => deprecated-tag}/tag.stories.tsx | 28 ++--- src/components/deprecated-tag/tag.tsx | 23 ++++ .../__snapshots__/tool-tip.test.tsx.snap | 16 --- src/components/dialog/styles.ts | 2 +- src/components/menu/styles.ts | 4 +- src/components/nav-dropdown-button/styles.ts | 2 +- src/components/nav-item/styles.ts | 2 +- src/components/nav-search-button/styles.ts | 4 +- .../__snapshots__/page-header.test.tsx.snap | 8 +- src/components/page-header/page-header.tsx | 12 +- src/components/status-indicator/index.ts | 1 + src/components/table/table-toolbar/styles.ts | 2 +- src/components/tag/tag.tsx | 20 --- src/index.ts | 5 +- src/tokens/payprop/tokens.css | 8 +- src/tokens/payprop/tokens.ts | 8 +- src/tokens/reapit/tokens.css | 8 +- src/tokens/reapit/tokens.ts | 8 +- src/tokens/tokens.json | 6 +- 40 files changed, 460 insertions(+), 401 deletions(-) delete mode 100644 src/components/badge/__tests__/__snapshots__/badge.test.tsx.snap delete mode 100644 src/components/badge/__tests__/badge.test.tsx delete mode 100644 src/components/badge/badge.stories.tsx delete mode 100644 src/components/badge/badge.tsx rename src/components/{badge => deprecated-badge}/__styles__/index.ts (86%) create mode 100644 src/components/deprecated-badge/__tests__/__snapshots__/badge.test.tsx.snap create mode 100644 src/components/deprecated-badge/__tests__/badge.test.tsx rename src/components/{badge => deprecated-badge}/badge.mdx (94%) create mode 100644 src/components/deprecated-badge/badge.stories.tsx create mode 100644 src/components/deprecated-badge/badge.tsx rename src/components/{badge => deprecated-badge}/index.ts (100%) rename src/components/{tag => deprecated-tag}/__styles__/index.ts (89%) rename src/components/{tag => deprecated-tag}/__tests__/__snapshots__/tag.test.tsx.snap (71%) rename src/components/{tag => deprecated-tag}/__tests__/tag.test.tsx (54%) rename src/components/{tag => deprecated-tag}/index.ts (100%) rename src/components/{tag => deprecated-tag}/tag.mdx (98%) rename src/components/{tag => deprecated-tag}/tag.stories.tsx (55%) create mode 100644 src/components/deprecated-tag/tag.tsx create mode 100644 src/components/status-indicator/index.ts delete mode 100644 src/components/tag/tag.tsx diff --git a/src/components/avatar/styles.ts b/src/components/avatar/styles.ts index f1d6ca2d..933d26b4 100644 --- a/src/components/avatar/styles.ts +++ b/src/components/avatar/styles.ts @@ -30,7 +30,7 @@ export const ElAvatar = styled.span` text-align: center; font-family: var(--font-family); font-style: normal; - font-weight: 600; + font-weight: var(--font-weight-semibold); ${baseColourDefaultStyle} ${baseCircleStyle} diff --git a/src/components/badge/__tests__/__snapshots__/badge.test.tsx.snap b/src/components/badge/__tests__/__snapshots__/badge.test.tsx.snap deleted file mode 100644 index 73bb47e1..00000000 --- a/src/components/badge/__tests__/__snapshots__/badge.test.tsx.snap +++ /dev/null @@ -1,114 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Badge component > should match a snapshot 1`] = ` - - - 50% - - -`; - -exports[`Badge component > should match a snapshot for intent 1`] = ` - - - Some Content - - -`; - -exports[`Badge component > should match a snapshot for intent 2`] = ` - - - Some Content - - -`; - -exports[`Badge component > should match a snapshot for intent 3`] = ` - - - Some Content - - -`; - -exports[`Badge component > should match a snapshot for intent 4`] = ` - - - Some Content - - -`; - -exports[`Badge component > should match a snapshot for intent 5`] = ` - - - Some Content - - -`; - -exports[`Badge component > should match a snapshot for intent 6`] = ` - - - Some Content - - -`; - -exports[`Badge component > should match a snapshot for intent 7`] = ` - - - Some Content - - -`; - -exports[`BadgeGroup component > should match a snapshot 1`] = ` - -
-
- - Some Content - - - Some Content - -
-
-
-`; diff --git a/src/components/badge/__tests__/badge.test.tsx b/src/components/badge/__tests__/badge.test.tsx deleted file mode 100644 index 0b018aad..00000000 --- a/src/components/badge/__tests__/badge.test.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { render } from '@testing-library/react' -import { Badge, BadgeGroup } from '..' - -describe('Badge component', () => { - it('should match a snapshot', () => { - const wrapper = render(50%) - expect(wrapper.asFragment()).toMatchSnapshot() - }) - - it('should match a snapshot for intent', () => { - const wrapper = render(Some Content) - expect(wrapper.asFragment()).toMatchSnapshot() - }) - - it('should match a snapshot for intent', () => { - const wrapper = render(Some Content) - expect(wrapper.asFragment()).toMatchSnapshot() - }) - - it('should match a snapshot for intent', () => { - const wrapper = render(Some Content) - expect(wrapper.asFragment()).toMatchSnapshot() - }) - - it('should match a snapshot for intent', () => { - const wrapper = render(Some Content) - expect(wrapper.asFragment()).toMatchSnapshot() - }) - - it('should match a snapshot for intent', () => { - const wrapper = render(Some Content) - expect(wrapper.asFragment()).toMatchSnapshot() - }) - - it('should match a snapshot for intent', () => { - const wrapper = render(Some Content) - expect(wrapper.asFragment()).toMatchSnapshot() - }) - - it('should match a snapshot for intent', () => { - const wrapper = render(Some Content) - expect(wrapper.asFragment()).toMatchSnapshot() - }) -}) - -describe('BadgeGroup component', () => { - it('should match a snapshot', () => { - const wrapper = render( - - Some Content - Some Content - , - ) - expect(wrapper.asFragment()).toMatchSnapshot() - }) -}) diff --git a/src/components/badge/badge.stories.tsx b/src/components/badge/badge.stories.tsx deleted file mode 100644 index 6a1adb6b..00000000 --- a/src/components/badge/badge.stories.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { Badge, BadgeGroup } from '.' - -export default { - title: 'Badge', - component: Badge, -} - -export const BasicUsage = { - render: ({}) => ( - - 100 - - ), -} - -export const WithIntent = { - render: ({}) => ( - - primary - neutral - success - pending - warning - danger - default - - ), -} diff --git a/src/components/badge/badge.tsx b/src/components/badge/badge.tsx deleted file mode 100644 index 0cd9cce0..00000000 --- a/src/components/badge/badge.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React, { FC, HTMLAttributes } from 'react' -import { cx } from '@linaria/core' -import { ElBadge, ElBadgeGroup, ElBadgeGroupInner } from './__styles__' -import { Intent, getIntentClassName } from '../../helpers/intent' - -export interface BadgeProps extends HTMLAttributes { - intent?: Intent -} - -export const Badge: FC = ({ children, intent, className, ...rest }) => ( - - {children} - -) - -export const BadgeGroup: FC> = ({ children, className, ...rest }) => ( - - {children} - -) diff --git a/src/components/button/button.mdx b/src/components/button/button.mdx index 13a99914..dad2fc04 100644 --- a/src/components/button/button.mdx +++ b/src/components/button/button.mdx @@ -58,6 +58,14 @@ With href prop, link can be displayed as button. Anchor attributes such as `targ +## Button With hasNoPadding + +The `hasNoPadding` prop is used with the `tertiary` variant of the button to demonstrate how removing padding and resetting the height can create a more minimalistic, compact button style. +This is useful when you need a button with no extra spacing or fixed height, while maintaining the button's core functionality and appearance. The prop is designed exclusively for the tertiary variant and will not affect other button variant types. + + + + ## Other attributes All other standard HTML attributes for `