Skip to content

Commit 5a360c1

Browse files
authored
updates Dropdown documentation, adds Figma addon for illustrations (#554)
1 parent e410f00 commit 5a360c1

File tree

3 files changed

+70
-17
lines changed

3 files changed

+70
-17
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
"react-test-renderer": "^16.12.0",
118118
"react-tracking": "8.1.0",
119119
"sass-loader": "^8.0.2",
120+
"storybook-addon-designs": "^6.2.1",
120121
"style-loader": "^1.1.3",
121122
"styled-components": "^5.3.3"
122123
},

src/Dropdown/Dropdown.mdx

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import { ArgsTable, Story, Canvas } from '@storybook/addon-docs/blocks';
2+
import { Figma } from "storybook-addon-designs/blocks"
23
import Dropdown from './Dropdown';
34

45
# Dropdown
56

67
##
78

89
<h4>
9-
Dropdowns are toggleable, contextual overlays for displaying lists of links and more.
10-
Dropdowns are built using a third-party library Popper.js, which provides dynamic positioning and viewport detection.
10+
A Dropdown displays a list of actions or selectable options that a user can take.
11+
Typically contained within a button, an action is initiated based on the selection.
1112
</h4>
1213

1314
<Canvas>
1415
<Story id="components-dropdown--default" />
1516
</Canvas>
1617

17-
### When to use
18-
- Reason 1
19-
- Reason 2
2018

2119
### When to not use
22-
- Reason 1
23-
- Reason 2
20+
Avoid the Dropdown component if:
21+
22+
- Users can select one or many from the options
23+
- There are more than 15 options
2424

2525
## Props
2626

@@ -52,23 +52,40 @@ import Dropdown from './Dropdown';
5252

5353
## Formatting
5454

55-
### States
56-
5755
### Anatomy
5856
- **Toggle: ** A button to open the dropdown menu.
5957

6058

61-
### Sizing
59+
## Best practices
6260

63-
### Alignment
61+
### General
62+
The Dropdown component should:
6463

64+
- Be used for secondary actions or information
65+
- Contain actions or options that are related to each other
66+
- Be used when the action need not be frequently taken
67+
- Display actions as disabled when they can only be used sometimes (instead of removing them)
6568

66-
## Best practices
69+
### UX Copy
6770

68-
### General
71+
The labels should:
6972

70-
### Behavior
73+
- Be clear and predictable.
74+
- Lead with a strong verb that encourages action.
75+
- To provide enough context, use {verb} + {noun} format unless the action is clear with a single verb
76+
- Be concise.
7177

72-
### Implementation
78+
### To Label, or Not To Label
79+
80+
Use a label if:
81+
82+
- The label needs to be displayed at all times
83+
- The action(s) taken is more frequent
84+
85+
Use the icon if:
86+
87+
- Space is an issue
88+
- It is already placed within context (i.e. at the end of a `Card`)
89+
90+
<Figma url="https://www.figma.com/file/471iS3QrpPtXZpS1xbsJ20/Components?node-id=8699%3A42280" />
7391

74-
### UX Copy

yarn.lock

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,22 @@
15401540
resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46"
15411541
integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==
15421542

1543+
"@figspec/components@^1.0.0":
1544+
version "1.0.0"
1545+
resolved "https://registry.yarnpkg.com/@figspec/components/-/components-1.0.0.tgz#b1ddf0593173157cb5e79e50073ca1491bb7c6dc"
1546+
integrity sha512-a8sgP0YLJ3H0g0pdZPYecxfp9JNVQUTaaU3xcSci8duHXTGkJ7X8QPPCBbyhB+MoxMxnsAh8GjkfZHEr9oIoPQ==
1547+
dependencies:
1548+
copy-to-clipboard "^3.0.0"
1549+
lit-element "^2.4.0"
1550+
lit-html "^1.1.1"
1551+
1552+
"@figspec/react@^1.0.0":
1553+
version "1.0.0"
1554+
resolved "https://registry.yarnpkg.com/@figspec/react/-/react-1.0.0.tgz#226ff85e146038b284ddf1ddbc086d2d14fe370a"
1555+
integrity sha512-BkOu3RsKF5vCtPoqsc6Oeyxw4wr9GesFrB9/wDHFqgjzhWsw8erFxCsPxsjdlJD8d8OWVHoM6SWxAaGe/pLdxg==
1556+
dependencies:
1557+
"@figspec/components" "^1.0.0"
1558+
15431559
"@fortawesome/fontawesome-common-types@^0.2.35":
15441560
version "0.2.35"
15451561
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.35.tgz#01dd3d054da07a00b764d78748df20daf2b317e9"
@@ -5308,7 +5324,7 @@ copy-descriptor@^0.1.0:
53085324
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
53095325
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
53105326

5311-
copy-to-clipboard@^3, copy-to-clipboard@^3.3.1:
5327+
copy-to-clipboard@^3, copy-to-clipboard@^3.0.0, copy-to-clipboard@^3.3.1:
53125328
version "3.3.1"
53135329
resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz#115aa1a9998ffab6196f93076ad6da3b913662ae"
53145330
integrity sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw==
@@ -9474,6 +9490,18 @@ listr2@^3.8.3:
94749490
through "^2.3.8"
94759491
wrap-ansi "^7.0.0"
94769492

9493+
lit-element@^2.4.0:
9494+
version "2.5.1"
9495+
resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-2.5.1.tgz#3fa74b121a6cd22902409ae3859b7847d01aa6b6"
9496+
integrity sha512-ogu7PiJTA33bEK0xGu1dmaX5vhcRjBXCFexPja0e7P7jqLhTpNKYRPmE+GmiCaRVAbiQKGkUgkh/i6+bh++dPQ==
9497+
dependencies:
9498+
lit-html "^1.1.1"
9499+
9500+
lit-html@^1.1.1:
9501+
version "1.4.1"
9502+
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-1.4.1.tgz#0c6f3ee4ad4eb610a49831787f0478ad8e9ae5e0"
9503+
integrity sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==
9504+
94779505
load-json-file@^1.0.0:
94789506
version "1.1.0"
94799507
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0"
@@ -12965,6 +12993,13 @@ store2@^2.12.0:
1296512993
resolved "https://registry.yarnpkg.com/store2/-/store2-2.12.0.tgz#e1f1b7e1a59b6083b2596a8d067f6ee88fd4d3cf"
1296612994
integrity sha512-7t+/wpKLanLzSnQPX8WAcuLCCeuSHoWdQuh9SB3xD0kNOM38DNf+0Oa+wmvxmYueRzkmh6IcdKFtvTa+ecgPDw==
1296712995

12996+
storybook-addon-designs@^6.2.1:
12997+
version "6.2.1"
12998+
resolved "https://registry.yarnpkg.com/storybook-addon-designs/-/storybook-addon-designs-6.2.1.tgz#47fd1a7a098cad027b3891bd72a7f9c1837d94a0"
12999+
integrity sha512-ihsscab8185HnxqTNZlM4TfrCPVsO7AimVA8BapuqT/sfZQF9m5H9C0plT3kbECdIMh2cmzMBF1Tc9ckWRgpWg==
13000+
dependencies:
13001+
"@figspec/react" "^1.0.0"
13002+
1296813003
stream-browserify@^2.0.1:
1296913004
version "2.0.2"
1297013005
resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b"

0 commit comments

Comments
 (0)