@@ -2,17 +2,15 @@ import {AccessibilityLabel, Note, StatusLabel} from '@primer/gatsby-theme-doctoc
2
2
import Code from '@primer/gatsby-theme-doctocat/src/components/code'
3
3
import { HEADER_HEIGHT } from '@primer/gatsby-theme-doctocat/src/components/header'
4
4
import { H2 , H3 } from '@primer/gatsby-theme-doctocat/src/components/heading'
5
- import InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code'
6
- import Table from '@primer/gatsby-theme-doctocat/src/components/table'
7
5
import TableOfContents from '@primer/gatsby-theme-doctocat/src/components/table-of-contents'
8
6
import { LinkExternalIcon } from '@primer/octicons-react'
9
7
import { Box , Heading , Label , Link , Text } from '@primer/react'
10
8
import React , { PropsWithChildren } from 'react'
11
- import ReactMarkdown from 'react-markdown'
12
9
import { StorybookEmbed } from '../components/storybook-embed'
13
10
import { BaseLayout } from '../components/base-layout'
14
11
import { ComponentPageNav } from '../components/component-page-nav'
15
12
import StatusMenu from '../components/status-menu'
13
+ import ReactPropsTable from './react-props-table'
16
14
17
15
type ReactComponentPageProps = {
18
16
// Data is the result of the ReactComponentInfo graphql fragment in react-component-layout.tsx
@@ -240,76 +238,3 @@ function sentenceCase(str: string) {
240
238
return str . toUpperCase ( )
241
239
} )
242
240
}
243
-
244
- // TODO: Make table responsive
245
- function ReactPropsTable ( {
246
- props,
247
- } : {
248
- props : Array < {
249
- name : string
250
- type : string
251
- defaultValue : string
252
- required : boolean
253
- deprecated : boolean
254
- description : string
255
- } >
256
- } ) {
257
- if ( props . length === 0 ) {
258
- return (
259
- < Box sx = { { padding : 3 , bg : 'canvas.inset' , textAlign : 'center' , color : 'fg.muted' , borderRadius : 2 } } > No props</ Box >
260
- )
261
- }
262
-
263
- return (
264
- < Box sx = { { overflow : 'auto' } } >
265
- < Table >
266
- < colgroup >
267
- < col style = { { width : '25%' } } />
268
- < col style = { { width : '15%' } } />
269
- < col style = { { width : '60%' } } />
270
- </ colgroup >
271
- < thead >
272
- < tr >
273
- < th align = "left" > Name</ th >
274
- < th align = "left" > Default</ th >
275
- < th align = "left" > Description</ th >
276
- </ tr >
277
- </ thead >
278
- < tbody >
279
- { props . map ( prop => (
280
- < tr key = { prop . name } >
281
- < td valign = "top" >
282
- < Box sx = { { display : 'flex' , gap : 2 , alignItems : 'center' } } >
283
- < Text sx = { { fontFamily : 'mono' , fontSize : 1 , whiteSpace : 'nowrap' } } > { prop . name } </ Text >
284
- { prop . required ? < Label > Required</ Label > : null }
285
- { prop . deprecated ? < Label variant = "danger" > Deprecated</ Label > : null }
286
- </ Box >
287
- </ td >
288
- < td valign = "top" > { prop . defaultValue ? < InlineCode > { prop . defaultValue } </ InlineCode > : null } </ td >
289
- < td >
290
- < InlineCode > { prop . type } </ InlineCode >
291
- < Box
292
- sx = { {
293
- '&:not(:empty)' : {
294
- mt : 2 ,
295
- } ,
296
- color : 'fg.muted' ,
297
- '& > :first-child' : {
298
- mt : 0 ,
299
- } ,
300
- '& > :last-child' : {
301
- mb : 0 ,
302
- } ,
303
- } }
304
- >
305
- { /* @ts -ignore */ }
306
- < ReactMarkdown components = { { a : Link , code : InlineCode } } > { prop . description } </ ReactMarkdown >
307
- </ Box >
308
- </ td >
309
- </ tr >
310
- ) ) }
311
- </ tbody >
312
- </ Table >
313
- </ Box >
314
- )
315
- }
0 commit comments