Skip to content

Commit 26b8da0

Browse files
authored
CSF3 cards (#3148)
* CSF 3 Cards and CardView
1 parent 3d93a8a commit 26b8da0

14 files changed

+2128
-1550
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
"@storybook/api": "^6.5.7",
8282
"@storybook/components": "^6.5.7",
8383
"@storybook/react": "^6.5.7",
84+
"@storybook/testing-react": "^1.3.0",
8485
"@testing-library/dom": "^8.0.0",
8586
"@testing-library/jest-dom": "^5.14.1",
8687
"@testing-library/react": "^13.2.0",

packages/@react-spectrum/card/chromatic/Card.chromatic.tsx

Lines changed: 693 additions & 12 deletions
Large diffs are not rendered by default.

packages/@react-spectrum/card/chromatic/CardView.chromatic.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function DynamicCardView(props: SpectrumCardViewProps<object>) {
6262
<CardView {...props} items={items} layout={layout} width="800px" height="800px" UNSAFE_style={{background: 'white'}} aria-label="Test CardView" selectionMode="multiple">
6363
{(item: any) => (
6464
<Card key={item.title} textValue={item.title} width={item.width} height={item.height}>
65-
<Image src={item.src} />
65+
<Image src={item.src} data-chromatic="ignore" />
6666
<Heading>{item.title}</Heading>
6767
<Text slot="detail">PNG</Text>
6868
<Content>Description</Content>
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Copyright 2021 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
import {Card} from '../index';
14+
import {
15+
CardStory,
16+
Default,
17+
DefaultSquare,
18+
DefaultTall,
19+
LongContent,
20+
LongDetail,
21+
LongTitle,
22+
NoDescription,
23+
NoDescriptionSquare,
24+
WithIllustration
25+
} from './Card.chromatic';
26+
import {ComponentMeta} from '@storybook/react';
27+
import React from 'react';
28+
29+
export default {
30+
title: 'Card/horizontal',
31+
component: Card,
32+
args: {
33+
orientation: 'horizontal'
34+
}
35+
} as ComponentMeta<typeof Card>;
36+
37+
export const Horizontal: CardStory = {
38+
...Default,
39+
decorators: [
40+
(Story) => (
41+
<div style={{height: '90px'}}>
42+
<Story />
43+
</div>
44+
)
45+
]
46+
};
47+
48+
export const HorizontalSquare: CardStory = {
49+
...DefaultSquare,
50+
...Horizontal,
51+
args: {...DefaultSquare.args}
52+
};
53+
54+
export const HorizontalTall: CardStory = {
55+
...DefaultTall,
56+
...Horizontal,
57+
args: {...DefaultTall.args}
58+
};
59+
60+
export const HorizontalNoDescription: CardStory = {
61+
...NoDescription,
62+
...Horizontal,
63+
args: {...NoDescription.args}
64+
};
65+
66+
export const HorizontalNoDescriptionSquare: CardStory = {
67+
...NoDescriptionSquare,
68+
...Horizontal,
69+
args: {...NoDescriptionSquare.args}
70+
};
71+
72+
export const HorizontalWithIllustration: CardStory = {
73+
...WithIllustration,
74+
...Horizontal,
75+
args: {...WithIllustration.args}
76+
};
77+
78+
export const HorizontalLongTitle: CardStory = {
79+
...LongTitle,
80+
...Horizontal,
81+
args: {...LongTitle.args}
82+
};
83+
84+
export const HorizontalLongDescription: CardStory = {
85+
...LongContent,
86+
...Horizontal,
87+
args: {...LongContent.args}
88+
};
89+
90+
export const HorizontalLongDetail: CardStory = {
91+
...LongDetail,
92+
...Horizontal,
93+
args: {...LongDetail.args}
94+
};
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* Copyright 2021 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
import {Card} from '../index';
14+
import {
15+
CardStory,
16+
Default,
17+
DefaultSquare,
18+
DefaultTall,
19+
LongContentPoorWordSize,
20+
LongDescription,
21+
LongDetail,
22+
LongEverything,
23+
LongTitle,
24+
NoDescription,
25+
NoDescriptionSquare,
26+
Selected,
27+
WithIllustration
28+
} from './Card.chromatic';
29+
import {ComponentMeta} from '@storybook/react';
30+
31+
export default {
32+
title: 'Card/quiet',
33+
component: Card,
34+
args: {
35+
isQuiet: true
36+
}
37+
} as ComponentMeta<typeof Card>;
38+
39+
export const Quiet: CardStory = {
40+
...Default
41+
};
42+
43+
export const QuietSquare = {
44+
...DefaultSquare
45+
};
46+
47+
export const QuietTall = {
48+
...DefaultTall
49+
};
50+
51+
export const QuietNoDescription = {
52+
...NoDescription
53+
};
54+
55+
export const QuietNoDescriptionSquare = {
56+
...NoDescriptionSquare
57+
};
58+
59+
export const QuietWithIllustration = {
60+
...WithIllustration
61+
};
62+
63+
export const QuietLongTitle = {
64+
...LongTitle
65+
};
66+
67+
export const QuietLongDescription = {
68+
...LongDescription
69+
};
70+
71+
export const QuietLongContentPoorWordSize = {
72+
...LongContentPoorWordSize
73+
};
74+
75+
export const QuietLongDetail = {
76+
...LongDetail
77+
};
78+
79+
export const QuietLongEverything = {
80+
...LongEverything
81+
};
82+
83+
export const QuietSelected = {
84+
...Selected,
85+
name: 'Selected'
86+
};

0 commit comments

Comments
 (0)