| 1 |
import { styled } from "@mui/material"; |
| 2 |
import * as React from "react"; |
| 3 |
|
| 4 |
export const PrefGroup = styled("div", { attrs: { role: "table" } })` |
| 5 |
display: flex; |
| 6 |
flex-direction: column; |
| 7 |
gap: 20px; |
| 8 |
`; |
| 9 |
|
| 10 |
const PrefRow = styled("div")` |
| 11 |
display: flex; |
| 12 |
flex-direction: row; |
| 13 |
|
| 14 |
> div:first-of-type { |
| 15 |
flex: 1 0 40%; |
| 16 |
display: flex; |
| 17 |
flex-direction: column; |
| 18 |
justify-content: ${(props) => (props.alignTop ? "normal" : "center")}; |
| 19 |
} |
| 20 |
|
| 21 |
> div:last-of-type { |
| 22 |
flex: 1 0 calc(60% - 50px); |
| 23 |
display: flex; |
| 24 |
flex-direction: column; |
| 25 |
justify-content: ${(props) => (props.alignTop ? "normal" : "center")}; |
| 26 |
} |
| 27 |
|
| 28 |
@media (max-width: 1000px) { |
| 29 |
flex-direction: column; |
| 30 |
gap: 10px; |
| 31 |
|
| 32 |
> :div:first-of-type, |
| 33 |
> :div:last-of-type { |
| 34 |
flex: unset; |
| 35 |
} |
| 36 |
|
| 37 |
> div:last-of-type { |
| 38 |
.MuiFormControl-root { |
| 39 |
margin: 0; |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
`; |
| 44 |
|
| 45 |
export const Pref = (props) => ( |
| 46 |
<PrefRow role="row" alignTop={props.alignTop}> |
| 47 |
<div role="cell" id={props.labelId ?? ""} aria-label={props.title}> |
| 48 |
<div> |
| 49 |
<b>{props.title}</b> |
| 50 |
{props.subtitle && <em> ({props.subtitle})</em>} |
| 51 |
</div> |
| 52 |
{props.description && ( |
| 53 |
<div> |
| 54 |
<em>{props.description}</em> |
| 55 |
</div> |
| 56 |
)} |
| 57 |
</div> |
| 58 |
<div role="cell">{props.children}</div> |
| 59 |
</PrefRow> |
| 60 |
); |