File size: 1,492 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Dismissible Card

This is a card component that can be dismissed for a single page load or be hidden
via user preference.

## How to use

```js
import DismissibleCard from 'calypso/blocks/dismissible-card';

function render() {
	return (
		<div className="your-stuff">
			<DismissibleCard preferenceName="my-unique-preference-name">
				<span>Your stuff in a Card</span>
			</DismissibleCard>
		</div>
	);
}
```

## Props

Below is a list of supported props.

### `className`

<table>
	<tr><td>Type</td><td>String</td></tr>
	<tr><td>Required</td><td>No</td></tr>
	<tr><td>Default</td><td><code>undefined</code></td></tr>
</table>

Any addition classes to pass to the card component.

### `onClick`

<table>
	<tr><td>Type</td><td>Function</td></tr>
	<tr><td>Required</td><td>No</td></tr>
	<tr><td>Default</td><td><code>lodash/noop</code></td></tr>
</table>

This function will fire when a user clicks on the cross icon

### `preferenceName`

<table>
	<tr><td>Type</td><td>String</td></tr>
	<tr><td>Required</td><td>Yes</td></tr>
	<tr><td>Default</td><td><code>n/a</code></td></tr>
</table>

The user preference name that we store a boolean against.
Note that we prefix this value with 'dismissible-card-' to avoid namespace collisions.

### `temporary`

<table>
	<tr><td>Type</td><td>Boolean</td></tr>
	<tr><td>Required</td><td>No</td></tr>
	<tr><td>Default</td><td><code>undefined</code></td></tr>
</table>

When true, clicking on the cross will dismiss the card for the current page load.