Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/yellow-chairs-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': minor
---

Simplify `AlphaCard` by removing `hasBorderRadius` prop and `shadow` prop
26 changes: 0 additions & 26 deletions polaris-react/src/components/AlphaCard/AlphaCard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,6 @@ export function BackgroundSubdued() {
);
}

export function WithoutBorderRadius() {
return (
<AlphaCard hasBorderRadius={false}>
<AlphaStack spacing="5">
<Text as="h3" variant="headingMd">
Online store dashboard
</Text>
<p>View a summary of your online store’s performance.</p>
</AlphaStack>
</AlphaCard>
);
}

export function BorderRadiusRoundedAbove() {
return (
<AlphaCard roundedAbove="sm">
Expand All @@ -57,16 +44,3 @@ export function BorderRadiusRoundedAbove() {
</AlphaCard>
);
}

export function Flat() {
return (
<AlphaCard shadow="transparent">
<AlphaStack spacing="5">
<Text as="h3" variant="headingMd">
Online store dashboard
</Text>
<p>View a summary of your online store’s performance.</p>
</AlphaStack>
</AlphaCard>
);
}
11 changes: 2 additions & 9 deletions polaris-react/src/components/AlphaCard/AlphaCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type {
BreakpointsAlias,
ColorsTokenName,
DepthShadowAlias,
ShapeBorderRadiusScale,
SpacingSpaceScale,
} from '@shopify/polaris-tokens';
Expand All @@ -10,8 +9,6 @@ import React from 'react';
import {useBreakpoints} from '../../utilities/breakpoints';
import {Box} from '../Box';

type CardShadowTokensScale = Extract<DepthShadowAlias, 'card' | 'transparent'>;

type CardBackgroundColorTokenScale = Extract<
ColorsTokenName,
'surface' | 'surface-subdued'
Expand All @@ -21,24 +18,20 @@ export interface AlphaCardProps {
/** Elements to display inside card */
children?: React.ReactNode;
background?: CardBackgroundColorTokenScale;
hasBorderRadius?: boolean;
shadow?: CardShadowTokensScale;
padding?: SpacingSpaceScale;
roundedAbove?: BreakpointsAlias;
}

export const AlphaCard = ({
children,
background = 'surface',
hasBorderRadius: hasBorderRadiusProp = true,
shadow = 'card',
padding = '5',
roundedAbove,
}: AlphaCardProps) => {
const breakpoints = useBreakpoints();
const defaultBorderRadius = '2' as ShapeBorderRadiusScale;

let hasBorderRadius = !roundedAbove && hasBorderRadiusProp;
let hasBorderRadius = !roundedAbove;

if (roundedAbove && breakpoints[`${roundedAbove}Up`]) {
hasBorderRadius = true;
Expand All @@ -48,7 +41,7 @@ export const AlphaCard = ({
<Box
background={background}
padding={padding}
shadow={shadow}
shadow="card"
{...(hasBorderRadius && {borderRadius: defaultBorderRadius})}
>
{children}
Expand Down
5 changes: 1 addition & 4 deletions polaris.shopify.com/content/components/alpha-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@ examples:
description: Use for content that you want to deprioritize. Subdued cards don’t stand out as much as cards with white backgrounds so don’t use them for information or actions that are critical to merchants.
- fileName: alpha-card-without-border-radius.tsx
title: Without border radius
description: Border radius can be toggled off, or added after a certain breakpoint.
- fileName: alpha-card-flat.tsx
title: Elevation
description: Elevation can be set to flat
description: Border radius can be toggled to display only past a certain breakpoint.
---
18 changes: 0 additions & 18 deletions polaris.shopify.com/pages/examples/alpha-card-flat.tsx

This file was deleted.

Loading