File tree Expand file tree Collapse file tree 3 files changed +51
-30
lines changed Expand file tree Collapse file tree 3 files changed +51
-30
lines changed Original file line number Diff line number Diff line change @@ -93,11 +93,9 @@ interface IProps extends React.BaseHTMLAttributes<HTMLDivElement> {
93
93
/**
94
94
* Values used in displaying bottom-left icon
95
95
*/
96
- stickerProps ?:
97
- | ( IClayStickerProps & {
98
- content ?: React . ReactNode ;
99
- } )
100
- | null ;
96
+ stickerProps ?: IClayStickerProps & {
97
+ content ?: React . ReactNode ;
98
+ } ;
101
99
102
100
/**
103
101
* Name of icon
@@ -125,7 +123,7 @@ export const ClayCardWithInfo: React.FunctionComponent<IProps> = ({
125
123
onSelectChange,
126
124
selected = false ,
127
125
spritemap,
128
- stickerProps,
126
+ stickerProps = { } ,
129
127
symbol,
130
128
title,
131
129
...otherProps
@@ -171,22 +169,20 @@ export const ClayCardWithInfo: React.FunctionComponent<IProps> = ({
171
169
/>
172
170
) }
173
171
174
- { stickerProps !== null && (
172
+ { stickerProps && (
175
173
< ClaySticker
176
174
displayType = {
177
- stickerProps && stickerProps . displayType
175
+ stickerProps . displayType
178
176
? stickerProps . displayType
179
177
: 'primary'
180
178
}
181
179
position = "bottom-left"
182
180
{ ...stickerProps }
183
181
>
184
- { stickerProps ? (
185
- stickerProps . children ? (
186
- stickerProps . children
187
- ) : (
188
- stickerProps . content
189
- )
182
+ { stickerProps . children ? (
183
+ stickerProps . children
184
+ ) : stickerProps . content ? (
185
+ stickerProps . content
190
186
) : (
191
187
< ClayIcon
192
188
spritemap = { spritemap }
Original file line number Diff line number Diff line change @@ -2321,7 +2321,16 @@ exports[`ClayCardWithInfo renders with custom sticker 1`] = `
2321
2321
>
2322
2322
<span
2323
2323
class = " sticker-overlay"
2324
- />
2324
+ >
2325
+ <svg
2326
+ class = " lexicon-icon lexicon-icon-document-default"
2327
+ role = " presentation"
2328
+ >
2329
+ <use
2330
+ xlink:href="/some/spritemap#document-default"
2331
+ />
2332
+ </svg >
2333
+ </span >
2325
2334
</span >
2326
2335
</div >
2327
2336
<div
@@ -2582,6 +2591,22 @@ exports[`ClayCardWithInfo renders with no sticker 1`] = `
2582
2591
/>
2583
2592
</svg >
2584
2593
</div >
2594
+ <span
2595
+ class = " sticker sticker-primary sticker-bottom-left"
2596
+ >
2597
+ <span
2598
+ class = " sticker-overlay"
2599
+ >
2600
+ <svg
2601
+ class = " lexicon-icon lexicon-icon-document-default"
2602
+ role = " presentation"
2603
+ >
2604
+ <use
2605
+ xlink:href="/path/to/some/resource.svg#document-default"
2606
+ />
2607
+ </svg >
2608
+ </span >
2609
+ </span >
2585
2610
</div >
2586
2611
</label >
2587
2612
</div >
Original file line number Diff line number Diff line change @@ -850,21 +850,6 @@ describe('ClayCardWithInfo', () => {
850
850
expect ( container ) . toMatchSnapshot ( ) ;
851
851
} ) ;
852
852
853
- it ( 'renders with no sticker' , ( ) => {
854
- const { container} = render (
855
- < ClayCardWithInfo
856
- href = "#"
857
- onSelectChange = { jest . fn ( ) }
858
- selected = { false }
859
- spritemap = "/path/to/some/resource.svg"
860
- stickerProps = { null }
861
- title = "Foo Bar"
862
- />
863
- ) ;
864
-
865
- expect ( container ) . toMatchSnapshot ( ) ;
866
- } ) ;
867
-
868
853
it ( 'renders as file card specifying the displayType' , ( ) => {
869
854
const { container} = render (
870
855
< ClayCardWithInfo
@@ -1020,6 +1005,21 @@ describe('ClayCardWithInfo', () => {
1020
1005
expect ( container ) . toMatchSnapshot ( ) ;
1021
1006
} ) ;
1022
1007
1008
+ it ( 'renders with no sticker' , ( ) => {
1009
+ const { container} = render (
1010
+ < ClayCardWithInfo
1011
+ href = "#"
1012
+ onSelectChange = { jest . fn ( ) }
1013
+ selected = { false }
1014
+ spritemap = "/path/to/some/resource.svg"
1015
+ stickerProps = { undefined }
1016
+ title = "Foo Bar"
1017
+ />
1018
+ ) ;
1019
+
1020
+ expect ( container ) . toMatchSnapshot ( ) ;
1021
+ } ) ;
1022
+
1023
1023
it ( 'clicking dropdown item calls callback and not call onSelectChange' , ( ) => {
1024
1024
const onDropDownItemClick = jest . fn ( ) ;
1025
1025
const onSelectChangeFn = jest . fn ( ) ;
You can’t perform that action at this time.
0 commit comments