forked from linode/manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabaseSettingsMenuItem.tsx
More file actions
84 lines (77 loc) · 1.92 KB
/
DatabaseSettingsMenuItem.tsx
File metadata and controls
84 lines (77 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { Typography } from '@linode/ui';
import { Button } from '@akamai/cds-components/react/Button';
import * as React from 'react';
import { makeStyles } from 'tss-react/mui';
import type { Theme } from '@mui/material/styles';
interface Props {
buttonText: string;
descriptiveText: string;
disabled?: boolean;
onClick: () => void;
sectionTitle: string;
}
const useStyles = makeStyles()((theme: Theme) => ({
sectionButton: {
minWidth: 214,
[theme.breakpoints.down('md')]: {
alignSelf: 'flex-start',
},
},
sectionText: {
[theme.breakpoints.down('md')]: {
marginBottom: '1rem',
},
[theme.breakpoints.down('sm')]: {
width: '100%',
},
width: '65%',
},
sectionTitle: {
marginBottom: '0.25rem',
},
sectionTitleAndText: {
width: '100%',
},
topSection: {
alignItems: 'center',
display: 'flex',
justifyContent: 'space-between',
[theme.breakpoints.down('md')]: {
flexDirection: 'column',
},
},
}));
export const DatabaseSettingsMenuItem = (props: Props) => {
const {
buttonText,
descriptiveText,
disabled = false,
onClick,
sectionTitle,
} = props;
const { classes } = useStyles();
return (
<div className={classes.topSection} data-qa-settings-section={sectionTitle}>
<div className={classes.sectionTitleAndText}>
<Typography className={classes.sectionTitle} variant="h3">
{sectionTitle}
</Typography>
<Typography className={classes.sectionText}>
{descriptiveText}
</Typography>
</div>
<Button
className={classes.sectionButton}
data-qa-settings-button={buttonText}
data-testid={`settings-button-${buttonText}`}
disabled={disabled}
onClick={onClick}
title={buttonText}
variant="secondary"
>
{buttonText}
</Button>
</div>
);
};
export default DatabaseSettingsMenuItem;