ntfy/web/src/components/Pref.jsx

53 lines
1.1 KiB
React
Raw Normal View History

2022-12-30 02:20:53 +13:00
import * as React from "react";
2023-05-24 19:03:28 +12:00
export const PrefGroup = (props) => <div role="table">{props.children}</div>;
2022-12-30 02:20:53 +13:00
export const Pref = (props) => {
2023-05-24 07:13:01 +12:00
const justifyContent = props.alignTop ? "normal" : "center";
return (
<div
role="row"
style={{
display: "flex",
flexDirection: "row",
marginTop: "10px",
marginBottom: "20px",
}}
>
<div
role="cell"
id={props.labelId ?? ""}
aria-label={props.title}
style={{
flex: "1 0 40%",
display: "flex",
flexDirection: "column",
2023-05-24 19:03:28 +12:00
justifyContent,
2023-05-24 07:13:01 +12:00
paddingRight: "30px",
}}
>
<div>
<b>{props.title}</b>
{props.subtitle && <em> ({props.subtitle})</em>}
2022-12-30 02:20:53 +13:00
</div>
2023-05-24 07:13:01 +12:00
{props.description && (
<div>
<em>{props.description}</em>
</div>
)}
</div>
<div
role="cell"
style={{
flex: "1 0 calc(60% - 50px)",
display: "flex",
flexDirection: "column",
2023-05-24 19:03:28 +12:00
justifyContent,
2023-05-24 07:13:01 +12:00
}}
>
{props.children}
</div>
</div>
);
2022-12-30 02:20:53 +13:00
};