This repository was archived by the owner on Mar 4, 2020. It is now read-only.
File tree 3 files changed +6
-13
lines changed
examples/components/Ref/Types
3 files changed +6
-13
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
import { Grid , Ref , Segment } from '@stardust-ui/react'
3
3
4
- const ExampleButton = React . forwardRef < HTMLButtonElement > ( ( props , ref ) => (
4
+ const ExampleButton = React . forwardRef < HTMLButtonElement , { children : string } > ( ( props , ref ) => (
5
5
< div >
6
6
< button { ...props } ref = { ref } />
7
7
</ div >
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import { ShorthandValue } from '../../../../../types/utils'
6
6
import GridImagePickerItem , { GridPickerItemProps } from './GridImagePickerItem'
7
7
8
8
export interface GridPickerProps {
9
- as ?: keyof React . ReactHTML
10
9
items : GridPickerItemProps [ ]
11
10
gridColumns ?: string | number
12
11
inputIcon ?: ShorthandValue
@@ -27,7 +26,6 @@ const inputStyles = {
27
26
28
27
class GridImagePicker extends React . Component < GridPickerProps > {
29
28
static defaultProps = {
30
- as : 'ul' ,
31
29
gridColumns : 5 ,
32
30
inputIcon : 'search' ,
33
31
inputPlaceholder : 'Search...' ,
@@ -41,7 +39,7 @@ class GridImagePicker extends React.Component<GridPickerProps> {
41
39
}
42
40
43
41
render ( ) {
44
- const { as : ElementType , gridColumns, inputIcon, inputPlaceholder } = this . props
42
+ const { gridColumns, inputIcon, inputPlaceholder } = this . props
45
43
46
44
return (
47
45
< >
@@ -53,7 +51,7 @@ class GridImagePicker extends React.Component<GridPickerProps> {
53
51
inputRef = { this . setInputNode }
54
52
/>
55
53
< Grid
56
- as = { ElementType }
54
+ as = "ul"
57
55
accessibility = { gridBehavior }
58
56
columns = { gridColumns }
59
57
style = { gridStyles }
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { Image, Button } from '@stardust-ui/react'
3
3
import * as React from 'react'
4
4
5
5
export interface GridPickerItemProps {
6
- as ?: keyof React . ReactHTML
7
6
title ?: string
8
7
imageSrc : string
9
8
onClick ?: ( e : React . SyntheticEvent , props : GridPickerItemProps ) => void
@@ -17,19 +16,15 @@ const imageButtonStyles = {
17
16
}
18
17
19
18
class GridImagePickerItem extends React . Component < GridPickerItemProps > {
20
- static defaultProps = {
21
- as : 'li' ,
22
- }
23
-
24
19
render ( ) {
25
- const { title, imageSrc, as : ElementType , onClick } = this . props
20
+ const { title, imageSrc, onClick } = this . props
26
21
27
22
return (
28
- < ElementType >
23
+ < li >
29
24
< Button styles = { imageButtonStyles } onClick = { onClick } title = { title } role = "listitem" >
30
25
{ imageSrc && < Image src = { imageSrc } fluid /> }
31
26
</ Button >
32
- </ ElementType >
27
+ </ li >
33
28
)
34
29
}
35
30
}
You can’t perform that action at this time.
0 commit comments