ntfy/web/src/components/Pref.jsx

61 lines
1.3 KiB
React
Raw Normal View History

import { styled } from "@mui/material";
2022-12-30 02:20:53 +13:00
import * as React from "react";
export const PrefGroup = styled("div", { attrs: { role: "table" } })`
display: flex;
flex-direction: column;
gap: 20px;
`;
const PrefRow = styled("div")`
display: flex;
flex-direction: row;
2023-06-29 09:38:57 +12:00
> div:first-of-type {
flex: 1 0 40%;
display: flex;
flex-direction: column;
justify-content: ${(props) => (props.alignTop ? "normal" : "center")};
}
2023-06-29 09:38:57 +12:00
> div:last-of-type {
flex: 1 0 calc(60% - 50px);
display: flex;
flex-direction: column;
justify-content: ${(props) => (props.alignTop ? "normal" : "center")};
}
@media (max-width: 1000px) {
flex-direction: column;
gap: 10px;
2023-06-29 09:38:57 +12:00
> :div:first-of-type,
> :div:last-of-type {
flex: unset;
}
2023-06-29 09:38:57 +12:00
> div:last-of-type {
.MuiFormControl-root {
margin: 0;
}
}
}
`;
export const Pref = (props) => (
<PrefRow role="row" alignTop={props.alignTop}>
<div role="cell" id={props.labelId ?? ""} aria-label={props.title}>
<div>
<b>{props.title}</b>
{props.subtitle && <em> ({props.subtitle})</em>}
</div>
{props.description && (
2023-05-24 07:13:01 +12:00
<div>
<em>{props.description}</em>
2022-12-30 02:20:53 +13:00
</div>
)}
2023-05-24 07:13:01 +12:00
</div>
<div role="cell">{props.children}</div>
</PrefRow>
);