@@ -21,7 +21,8 @@ const displays = {
2121const StyledButton = styled . button `
2222 &&& {
2323 font-weight: bold;
24- display: flex;
24+ display: ${ ( { display } ) =>
25+ display === displays . inline ? 'inline-flex' : 'flex' } ;
2526 justify-content: center;
2627 align-items: center;
2728
@@ -107,57 +108,6 @@ const StyledInlineButton = styled.button`
107108 }
108109` ;
109110
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-
161111/**
162112 * A Button performs an primary action
163113 */
@@ -184,12 +134,8 @@ const Button = ({
184134 ) ;
185135 let StyledComponent = StyledButton ;
186136
187- if ( display === displays . inline ) {
188- StyledComponent = StyledInlineButton ;
189- }
190-
191137 if ( iconOnly ) {
192- StyledComponent = StyledIconButton ;
138+ StyledComponent = StyledInlineButton ;
193139 }
194140
195141 if ( href ) {
@@ -265,7 +211,7 @@ Button.propTypes = {
265211 /**
266212 * The display type of the button—inline or block
267213 */
268- display : PropTypes . string ,
214+ display : PropTypes . oneOf ( Object . values ( displays ) ) ,
269215 /**
270216 * SVG icon to place after child content
271217 */
@@ -286,7 +232,7 @@ Button.propTypes = {
286232 * Specifying an href will use an <a> to link to the URL
287233 */
288234 href : PropTypes . string ,
289- /*
235+ /**
290236 * An ARIA Label used for accessibility
291237 */
292238 'aria-label' : PropTypes . string ,
0 commit comments