Skip to content

Commit 5361825

Browse files
committed
chore(website): Update HoverableMenus example to not use TextArea
The textarea made the mobile experience terrible since you'd have to click inside the text area to close them menus causing the keyboard to appear.
1 parent 1288be7 commit 5361825

File tree

2 files changed

+32
-17
lines changed

2 files changed

+32
-17
lines changed

packages/documentation/src/components/Demos/Menu/HoverableMenus.module.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@use 'react-md' as *;
2+
13
.container {
24
display: grid;
35
grid-template: max-content 1fr / 1fr;
@@ -9,6 +11,13 @@
911
padding: 0 0.5rem;
1012
}
1113

14+
.text {
15+
@include rmd-typography-theme(max-width, line-width);
16+
17+
justify-self: center;
18+
margin: 1rem;
19+
}
20+
1221
.dialog {
1322
width: 30rem;
1423
}

packages/documentation/src/components/Demos/Menu/HoverableMenus.tsx

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
Form,
1515
MenuItemCheckbox,
1616
MenuItemRadio,
17-
TextArea,
1817
TextFieldWithMessage,
1918
useNumberField,
2019
} from "@react-md/form";
@@ -115,6 +114,8 @@ export default function HoverableMenus(): ReactElement {
115114
id: "hoverable-menus-hover-timeout",
116115
min: 0,
117116
max: 3000,
117+
step: 100,
118+
fixOnBlur: false,
118119
});
119120

120121
return (
@@ -254,21 +255,21 @@ export default function HoverableMenus(): ReactElement {
254255
</DropdownMenu>
255256
</MenuBar>
256257
</AppBar>
257-
<TextArea
258-
aria-label="Text Sample"
259-
id="hoverable-menus-textarea"
260-
resize="none"
261-
areaStyle={{
262-
color: color === "" ? undefined : color,
263-
fontFamily,
264-
fontSize,
265-
fontStyle: italic ? "italic" : undefined,
266-
fontWeight: bold ? "bold" : undefined,
267-
textAlign,
268-
textDecoration,
269-
}}
270-
defaultValue={EXAMPLE_TEXT}
271-
/>
258+
<div className={styles.text}>
259+
<Typography
260+
style={{
261+
color: color === "" ? undefined : color,
262+
fontFamily,
263+
fontSize,
264+
fontStyle: italic ? "italic" : undefined,
265+
fontWeight: bold ? "bold" : undefined,
266+
textAlign,
267+
textDecoration,
268+
}}
269+
>
270+
{EXAMPLE_TEXT}
271+
</Typography>
272+
</div>
272273
<Button
273274
theme="warning"
274275
floating="bottom-left"
@@ -322,7 +323,12 @@ export default function HoverableMenus(): ReactElement {
322323
<Button form="configure-form" type="reset" theme="warning">
323324
Reset
324325
</Button>
325-
<Button form="configure-form" type="submit" theme="primary">
326+
<Button
327+
form="configure-form"
328+
type="submit"
329+
theme="primary"
330+
disabled={textFieldProps.error}
331+
>
326332
Confirm
327333
</Button>
328334
</DialogFooter>

0 commit comments

Comments
 (0)