@@ -21,7 +21,8 @@ const displays = {
21
21
const StyledButton = styled . button `
22
22
&&& {
23
23
font-weight: bold;
24
- display: flex;
24
+ display: ${ ( { display } ) =>
25
+ display === displays . inline ? 'inline-flex' : 'flex' } ;
25
26
justify-content: center;
26
27
align-items: center;
27
28
@@ -107,57 +108,6 @@ const StyledInlineButton = styled.button`
107
108
}
108
109
` ;
109
110
110
- const StyledIconButton = styled . button `
111
- &&& {
112
- display: flex;
113
- justify-content: center;
114
- align-items: center;
115
-
116
- width: ${ remSize ( 32 ) } px;
117
- height: ${ remSize ( 32 ) } px;
118
- text-decoration: none;
119
-
120
- color: ${ ( { kind } ) => prop ( `Button.${ kind } .default.foreground` ) } ;
121
- background-color: ${ ( { kind } ) => prop ( `Button.${ kind } .hover.background` ) } ;
122
- cursor: pointer;
123
- border: 1px solid transparent;
124
- border-radius: 50%;
125
- padding: ${ remSize ( 8 ) } ${ remSize ( 25 ) } ;
126
- line-height: 1;
127
-
128
- &:hover:not(:disabled) {
129
- color: ${ ( { kind } ) => prop ( `Button.${ kind } .hover.foreground` ) } ;
130
- background-color: ${ ( { kind } ) =>
131
- prop ( `Button.${ kind } .hover.background` ) } ;
132
-
133
- svg * {
134
- fill: ${ ( { kind } ) => prop ( `Button.${ kind } .hover.foreground` ) } ;
135
- }
136
- }
137
-
138
- &:active:not(:disabled) {
139
- color: ${ ( { kind } ) => prop ( `Button.${ kind } .active.foreground` ) } ;
140
- background-color: ${ ( { kind } ) =>
141
- prop ( `Button.${ kind } .active.background` ) } ;
142
-
143
- svg * {
144
- fill: ${ ( { kind } ) => prop ( `Button.${ kind } .active.foreground` ) } ;
145
- }
146
- }
147
-
148
- &:disabled {
149
- color: ${ ( { kind } ) => prop ( `Button.${ kind } .disabled.foreground` ) } ;
150
- background-color: ${ ( { kind } ) =>
151
- prop ( `Button.${ kind } .disabled.background` ) } ;
152
- cursor: not-allowed;
153
- }
154
-
155
- > * + * {
156
- margin-left: ${ remSize ( 8 ) } ;
157
- }
158
- }
159
- ` ;
160
-
161
111
/**
162
112
* A Button performs an primary action
163
113
*/
@@ -184,12 +134,8 @@ const Button = ({
184
134
) ;
185
135
let StyledComponent = StyledButton ;
186
136
187
- if ( display === displays . inline ) {
188
- StyledComponent = StyledInlineButton ;
189
- }
190
-
191
137
if ( iconOnly ) {
192
- StyledComponent = StyledIconButton ;
138
+ StyledComponent = StyledInlineButton ;
193
139
}
194
140
195
141
if ( href ) {
@@ -265,7 +211,7 @@ Button.propTypes = {
265
211
/**
266
212
* The display type of the button—inline or block
267
213
*/
268
- display : PropTypes . string ,
214
+ display : PropTypes . oneOf ( Object . values ( displays ) ) ,
269
215
/**
270
216
* SVG icon to place after child content
271
217
*/
@@ -286,7 +232,7 @@ Button.propTypes = {
286
232
* Specifying an href will use an <a> to link to the URL
287
233
*/
288
234
href : PropTypes . string ,
289
- /*
235
+ /**
290
236
* An ARIA Label used for accessibility
291
237
*/
292
238
'aria-label' : PropTypes . string ,
0 commit comments