Skip to content

Commit 457426c

Browse files
TileData: removed width and max width definitions (#4041)
1 parent 47a9106 commit 457426c

File tree

3 files changed

+1442
-1531
lines changed

3 files changed

+1442
-1531
lines changed

packages/gestalt/src/TileData.css

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,6 @@
88
composes: solid from "./Borders.css";
99
composes: transparentBorder from "./Borders.css";
1010
box-sizing: border-box;
11-
width: min-content;
12-
}
13-
14-
.tileWidth {
15-
max-width: 196px;
16-
}
17-
18-
@media (--g-sm) {
19-
.tileWidth {
20-
max-width: none;
21-
}
2211
}
2312

2413
.hovered {

packages/gestalt/src/TileData.tsx

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useId } from 'react';
22
import classnames from 'classnames';
3-
import Box from './Box';
43
import InternalCheckbox from './Checkbox/InternalCheckbox';
54
import { useColorScheme } from './contexts/ColorSchemeProvider';
65
import InternalDatapoint from './Datapoint/InternalDatapoint';
@@ -133,13 +132,6 @@ export default function TileData({
133132

134133
const checkboxId = useId();
135134

136-
const getClasses = () =>
137-
classnames(styles.baseTile, styles.tileWidth, {
138-
[styles.hovered]: isHovered,
139-
[styles.disabled]: disabled,
140-
[styles[`dataVisualizationColor${color}`]]: selected && !disabled,
141-
});
142-
143135
const tileStyle = selected && !disabled ? colorStyles : {};
144136
const checkBoxStyle = getCheckboxColors({
145137
state: { hovered: isHovered, selected: !!selected, disabled },
@@ -148,42 +140,48 @@ export default function TileData({
148140

149141
return (
150142
<MaybeTooltip disabled={disabled} tooltip={tooltip}>
151-
<Box>
152-
<TapArea
153-
disabled={disabled}
154-
onBlur={handleOnBlur}
155-
onMouseEnter={handleOnMouseEnter}
156-
onMouseLeave={handleOnMouseLeave}
157-
onTap={({ event }) => onTap?.({ event, id, selected: !selected })}
158-
role="button"
159-
rounding={4}
143+
<TapArea
144+
disabled={disabled}
145+
fullWidth={false}
146+
onBlur={handleOnBlur}
147+
onMouseEnter={handleOnMouseEnter}
148+
onMouseLeave={handleOnMouseLeave}
149+
onTap={({ event }) => onTap?.({ event, id, selected: !selected })}
150+
role="button"
151+
rounding={4}
152+
>
153+
<div
154+
className={classnames(styles.baseTile, {
155+
[styles.hovered]: isHovered,
156+
[styles.disabled]: disabled,
157+
[styles[`dataVisualizationColor${color}`]]: selected && !disabled,
158+
})}
159+
style={tileStyle}
160160
>
161-
<div className={getClasses()} style={tileStyle}>
162-
<Flex direction="row" gap={2}>
163-
<InternalDatapoint
164-
disabled={disabled}
165-
lineClamp={2}
166-
maxTitleWidth={135}
167-
minTitleWidth={80}
168-
numTitleRows={2}
169-
title={title}
170-
trend={trend}
171-
trendSentiment={trendSentiment}
172-
value={value}
161+
<Flex direction="row" gap={2}>
162+
<InternalDatapoint
163+
disabled={disabled}
164+
lineClamp={2}
165+
maxTitleWidth={135}
166+
minTitleWidth={80}
167+
numTitleRows={2}
168+
title={title}
169+
trend={trend}
170+
trendSentiment={trendSentiment}
171+
value={value}
172+
/>
173+
{showCheckbox && (
174+
<InternalCheckbox
175+
checked={selected}
176+
id={`readonly-checkbox-blah-${checkboxId}`}
177+
readOnly
178+
size="sm"
179+
style={checkBoxStyle}
173180
/>
174-
{showCheckbox && (
175-
<InternalCheckbox
176-
checked={selected}
177-
id={`readonly-checkbox-blah-${checkboxId}`}
178-
readOnly
179-
size="sm"
180-
style={checkBoxStyle}
181-
/>
182-
)}
183-
</Flex>
184-
</div>
185-
</TapArea>
186-
</Box>
181+
)}
182+
</Flex>
183+
</div>
184+
</TapArea>
187185
</MaybeTooltip>
188186
);
189187
}

0 commit comments

Comments
 (0)