@khanacademy/wonder-blocks-button 2.11.7 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -87,7 +87,7 @@ export default class ButtonCore extends React.Component<Props> {
87
87
  ? buttonStyles.active
88
88
  : (hovered || focused) && buttonStyles.focus),
89
89
  size === "small" && sharedStyles.small,
90
- size === "xlarge" && sharedStyles.xlarge,
90
+ size === "large" && sharedStyles.large,
91
91
  ];
92
92
 
93
93
  const commonProps = {
@@ -100,11 +100,15 @@ export default class ButtonCore extends React.Component<Props> {
100
100
 
101
101
  const Label = size === "small" ? LabelSmall : LabelLarge;
102
102
 
103
+ // We have to use `medium` for both md and lg buttons so we can fit the
104
+ // icons in large buttons.
105
+ const iconSize = size === "small" ? "small" : "medium";
106
+
103
107
  const label = (
104
108
  <Label
105
109
  style={[
106
110
  sharedStyles.text,
107
- size === "xlarge" && sharedStyles.xlargeText,
111
+ size === "large" && sharedStyles.largeText,
108
112
  icon && sharedStyles.textWithIcon,
109
113
  spinner && sharedStyles.hiddenText,
110
114
  kind === "tertiary" && sharedStyles.textWithFocus,
@@ -118,7 +122,7 @@ export default class ButtonCore extends React.Component<Props> {
118
122
  >
119
123
  {icon && (
120
124
  <Icon
121
- size={size}
125
+ size={iconSize}
122
126
  color="currentColor"
123
127
  icon={icon}
124
128
  style={sharedStyles.icon}
@@ -138,10 +142,11 @@ export default class ButtonCore extends React.Component<Props> {
138
142
  {
139
143
  medium: "small",
140
144
  small: "xsmall",
141
- xlarge: "medium",
145
+ large: "medium",
142
146
  }[size]
143
147
  }
144
148
  light={kind === "primary"}
149
+ testId={`${testId || "button"}-spinner`}
145
150
  />
146
151
  )}
147
152
  </React.Fragment>
@@ -215,8 +220,9 @@ const sharedStyles = StyleSheet.create({
215
220
  small: {
216
221
  height: 32,
217
222
  },
218
- xlarge: {
219
- height: 60,
223
+ large: {
224
+ borderRadius: Spacing.xxSmall_6,
225
+ height: 56,
220
226
  },
221
227
  text: {
222
228
  alignItems: "center",
@@ -227,7 +233,7 @@ const sharedStyles = StyleSheet.create({
227
233
  display: "inline-block", // allows the button text to truncate
228
234
  pointerEvents: "none", // fix Safari bug where the browser was eating mouse events
229
235
  },
230
- xlargeText: {
236
+ largeText: {
231
237
  fontSize: 18,
232
238
  lineHeight: "20px",
233
239
  },
@@ -260,7 +266,7 @@ const _generateStyles = (color, kind, light, iconWidth, size) => {
260
266
  const {white, white50, white64, offBlack32, offBlack50, darkBlue} = Color;
261
267
  const fadedColor = mix(fade(color, 0.32), white);
262
268
  const activeColor = mix(offBlack32, color);
263
- const padding = size === "xlarge" ? Spacing.xLarge_32 : Spacing.medium_16;
269
+ const padding = size === "large" ? Spacing.xLarge_32 : Spacing.medium_16;
264
270
 
265
271
  let newStyles = {};
266
272
  if (kind === "primary") {
@@ -60,9 +60,9 @@ export type SharedProps = {|
60
60
 
61
61
  /**
62
62
  * The size of the button. "medium" = height: 40; "small" = height: 32;
63
- * "xlarge" = height: 60;
63
+ * "large" = height: 56;
64
64
  */
65
- size: "medium" | "small" | "xlarge",
65
+ size: "medium" | "small" | "large",
66
66
 
67
67
  /**
68
68
  * Whether the button is disabled.