1
1
import React from 'react'
2
2
import { StoryFn , Meta } from '@storybook/react'
3
3
import { Card , CardIconColors } from '.'
4
- import { Stack , LabelColors , Grid , ThemeProvider , Box } from '..'
4
+ import { Stack , LabelColors , Grid , ThemeProvider , Box , type IconProps } from '..'
5
5
import placeholderImage from '../fixtures/images/placeholder-600x400.png'
6
6
import { CopilotIcon , ZapIcon , RocketIcon , GitBranchIcon , HeartIcon } from '@primer/octicons-react'
7
7
@@ -78,7 +78,7 @@ export const Label: StoryFn<typeof Card> = () => {
78
78
export const Icon : StoryFn < typeof Card > = ( ) => {
79
79
return (
80
80
< Card href = "https://github.com" >
81
- < Card . Icon icon = { < RocketIcon /> } />
81
+ < Card . Icon icon = { RocketIcon } />
82
82
< Card . Heading > Code search & code view </ Card . Heading >
83
83
< Card . Description >
84
84
Enables you to rapidly search, navigate, and understand code, right from GitHub.com.
@@ -90,7 +90,7 @@ export const Icon: StoryFn<typeof Card> = () => {
90
90
export const Border : StoryFn < typeof Card > = ( ) => {
91
91
return (
92
92
< Card href = "https://github.com" hasBorder >
93
- < Card . Icon icon = { < RocketIcon /> } />
93
+ < Card . Icon icon = { RocketIcon } />
94
94
< Card . Heading > Code search & code view </ Card . Heading >
95
95
< Card . Description >
96
96
Enables you to rapidly search, navigate, and understand code, right from GitHub.com.
@@ -105,7 +105,7 @@ export const IconColors: StoryFn<typeof Card> = () => {
105
105
{ CardIconColors . map ( ( color , id ) => {
106
106
return (
107
107
< Card key = { id } href = "https://github.com" >
108
- < Card . Icon icon = { < CopilotIcon /> } hasBackground color = { color } />
108
+ < Card . Icon icon = { CopilotIcon } hasBackground color = { color } />
109
109
< Card . Heading > Collaboration is the key to DevOps success</ Card . Heading >
110
110
< Card . Description >
111
111
This Card uses the < b > { color } </ b > icon color
@@ -120,7 +120,7 @@ export const IconColors: StoryFn<typeof Card> = () => {
120
120
export const WithIconSVG = ( ) => (
121
121
< Card href = "https://github.com" >
122
122
< Card . Icon
123
- icon = {
123
+ icon = { ( ) => (
124
124
< svg
125
125
xmlns = "http://www.w3.org/2000/svg"
126
126
viewBox = "0 0 16 16"
@@ -133,7 +133,7 @@ export const WithIconSVG = () => (
133
133
fill = "currentColor"
134
134
> </ path >
135
135
</ svg >
136
- }
136
+ ) }
137
137
hasBackground
138
138
color = "purple"
139
139
/>
@@ -148,7 +148,7 @@ WithIconSVG.storyName = 'Icon (native)'
148
148
export const IconAndLabel : StoryFn < typeof Card > = ( ) => {
149
149
return (
150
150
< Card href = "https://github.com" >
151
- < Card . Icon icon = { < GitBranchIcon /> } color = "purple" hasBackground />
151
+ < Card . Icon icon = { GitBranchIcon } color = "purple" hasBackground />
152
152
< Card . Heading > Code search & code view </ Card . Heading >
153
153
< Card . Label color = "blue-purple" > Beta</ Card . Label >
154
154
< Card . Description >
@@ -198,14 +198,14 @@ export const ImageUsingPictureElement: StoryFn<typeof Card> = () => {
198
198
const fixtureData : FixtureData = [
199
199
{
200
200
href : 'https://github.com' ,
201
- icon : < CopilotIcon /> ,
201
+ icon : CopilotIcon ,
202
202
iconColor : 'indigo' ,
203
203
heading : 'Collaboration is the key to DevOps success' ,
204
204
description : 'Everything you need to know about getting started with GitHub Actions.' ,
205
205
} ,
206
206
{
207
207
href : 'https://github.com' ,
208
- icon : < RocketIcon /> ,
208
+ icon : RocketIcon ,
209
209
iconColor : 'purple' ,
210
210
heading : 'GitHub Actions cheat sheet and more' ,
211
211
description : (
@@ -216,7 +216,7 @@ const fixtureData: FixtureData = [
216
216
} ,
217
217
{
218
218
href : 'https://github.com' ,
219
- icon : < GitBranchIcon /> ,
219
+ icon : GitBranchIcon ,
220
220
iconColor : 'teal' ,
221
221
heading : 'How healthy teams build better software' ,
222
222
description : (
@@ -225,7 +225,7 @@ const fixtureData: FixtureData = [
225
225
} ,
226
226
{
227
227
href : 'https://github.com' ,
228
- icon : < HeartIcon /> ,
228
+ icon : HeartIcon ,
229
229
iconColor : 'pink' ,
230
230
heading : 'GitHub sponsors' ,
231
231
description :
@@ -235,7 +235,7 @@ const fixtureData: FixtureData = [
235
235
236
236
type FixtureData = {
237
237
href : string
238
- icon ?: React . ReactNode
238
+ icon : IconProps [ 'icon' ]
239
239
iconColor ?: ( typeof CardIconColors ) [ number ]
240
240
label ?: string
241
241
labelColor ?: ( typeof LabelColors ) [ number ]
@@ -272,15 +272,15 @@ export const DarkColorModeEffect = () => {
272
272
gap = { 36 }
273
273
>
274
274
< Card href = "https://github.com" >
275
- < Card . Icon icon = { < ZapIcon /> } hasBackground />
275
+ < Card . Icon icon = { ZapIcon } hasBackground />
276
276
< Card . Heading > Collaboration is the key to DevOps success</ Card . Heading >
277
277
< Card . Description > Everything you need to know about getting started with GitHub Actions.</ Card . Description >
278
278
</ Card >
279
279
< Card
280
280
href = "https://github.com"
281
281
style = { { [ '--brand-color-accent-primary' as string ] : 'var(--base-color-scale-indigo-2)' } }
282
282
>
283
- < Card . Icon icon = { < CopilotIcon /> } hasBackground color = "indigo" />
283
+ < Card . Icon icon = { CopilotIcon } hasBackground color = "indigo" />
284
284
< Card . Heading > Collaboration is the key to DevOps success</ Card . Heading >
285
285
< Card . Description > Everything you need to know about getting started with GitHub Actions.</ Card . Description >
286
286
</ Card >
@@ -289,7 +289,7 @@ export const DarkColorModeEffect = () => {
289
289
href = "https://github.com"
290
290
style = { { [ '--brand-color-accent-primary' as string ] : 'var(--base-color-scale-yellow-2)' } }
291
291
>
292
- < Card . Icon icon = { < GitBranchIcon /> } hasBackground color = "yellow" />
292
+ < Card . Icon icon = { GitBranchIcon } hasBackground color = "yellow" />
293
293
< Card . Heading > Collaboration is the key to DevOps success</ Card . Heading >
294
294
< Card . Description > Everything you need to know about getting started with GitHub Actions.</ Card . Description >
295
295
</ Card >
@@ -305,7 +305,7 @@ export const DarkColorModeEffect = () => {
305
305
href = "https://github.com"
306
306
style = { { [ '--brand-color-accent-primary' as string ] : 'var(--base-color-scale-red-2)' } }
307
307
>
308
- < Card . Icon icon = { < HeartIcon /> } hasBackground color = "red" />
308
+ < Card . Icon icon = { HeartIcon } hasBackground color = "red" />
309
309
< Card . Heading > Collaboration is the key to DevOps success</ Card . Heading >
310
310
< Card . Description > Everything you need to know about getting started with GitHub Actions.</ Card . Description >
311
311
</ Card >
@@ -314,15 +314,15 @@ export const DarkColorModeEffect = () => {
314
314
href = "https://github.com"
315
315
style = { { [ '--brand-color-accent-primary' as string ] : 'var(--base-color-scale-orange-2)' } }
316
316
>
317
- < Card . Icon icon = { < ZapIcon /> } hasBackground color = "orange" />
317
+ < Card . Icon icon = { ZapIcon } hasBackground color = "orange" />
318
318
< Card . Heading > Collaboration is the key to DevOps success</ Card . Heading >
319
319
< Card . Description > Everything you need to know about getting started with GitHub Actions.</ Card . Description >
320
320
</ Card >
321
321
< Card
322
322
href = "https://github.com"
323
323
style = { { [ '--brand-color-accent-primary' as string ] : 'var(--base-color-scale-lime-2)' } }
324
324
>
325
- < Card . Icon icon = { < RocketIcon /> } hasBackground color = "lime" />
325
+ < Card . Icon icon = { RocketIcon } hasBackground color = "lime" />
326
326
< Card . Heading > Collaboration is the key to DevOps success</ Card . Heading >
327
327
< Card . Description > Everything you need to know about getting started with GitHub Actions.</ Card . Description >
328
328
</ Card >
0 commit comments