mirror of
https://github.com/muerwre/markdown-home-tab.git
synced 2025-04-25 00:46:41 +07:00
added gaps to settings
This commit is contained in:
parent
b39633c736
commit
2a5dd5ca30
5 changed files with 149 additions and 103 deletions
13
src/components/containers/Grid/index.tsx
Normal file
13
src/components/containers/Grid/index.tsx
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import { FC, PropsWithChildren } from "react";
|
||||||
|
import styles from "./styles.module.scss";
|
||||||
|
import classNames from "classnames";
|
||||||
|
|
||||||
|
type VerticalListProps = PropsWithChildren & {
|
||||||
|
direction?: "row" | "column";
|
||||||
|
};
|
||||||
|
|
||||||
|
const Grid: FC<VerticalListProps> = ({ children, direction = "column" }) => (
|
||||||
|
<div className={classNames(styles.list, styles[direction])}>{children}</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
export { Grid };
|
16
src/components/containers/Grid/styles.module.scss
Normal file
16
src/components/containers/Grid/styles.module.scss
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
.list {
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&.column {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.row {
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: stretch;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,18 +1,25 @@
|
||||||
import { FC, ReactNode } from "react";
|
import { FC, ReactNode, useMemo } from "react";
|
||||||
import styles from "./styles.module.scss";
|
import styles from "./styles.module.scss";
|
||||||
|
|
||||||
interface RowGroupProps {
|
interface RowGroupProps {
|
||||||
children: ReactNode[];
|
children: ReactNode | ReactNode[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const RowGroup: FC<RowGroupProps> = ({ children }) => (
|
const RowGroup: FC<RowGroupProps> = ({ children }) => {
|
||||||
|
const items = useMemo(
|
||||||
|
() => (Array.isArray(children) ? children : [children]),
|
||||||
|
[children]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
<div className={styles.group}>
|
<div className={styles.group}>
|
||||||
{children.map((item, key) => (
|
{items.map((item, key) => (
|
||||||
<div key={key} className={styles.row}>
|
<div key={key} className={styles.row}>
|
||||||
{item}
|
{item}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export { RowGroup };
|
export { RowGroup };
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
box-shadow: var(--color-border) 0 0 0 1px;
|
box-shadow: var(--color-border) 0 0 0 1px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.row {
|
.row {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
import { useBuiltinThemes } from "~/modules/theme/constants/themes";
|
import { useBuiltinThemes } from "~/modules/theme/constants/themes";
|
||||||
import { fillThemeHeadings } from "~/modules/theme/utils/fillThemeHeadings";
|
import { fillThemeHeadings } from "~/modules/theme/utils/fillThemeHeadings";
|
||||||
import { ThemeSelect } from "../../components/ThemeSelect";
|
import { ThemeSelect } from "../../components/ThemeSelect";
|
||||||
|
import { Grid } from "~/components/containers/Grid";
|
||||||
|
|
||||||
const ColorSettings: FC = () => {
|
const ColorSettings: FC = () => {
|
||||||
const { update, settings } = useSettings();
|
const { update, settings } = useSettings();
|
||||||
|
@ -55,6 +56,7 @@ const ColorSettings: FC = () => {
|
||||||
}, [currentTheme, t]);
|
}, [currentTheme, t]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<Grid>
|
||||||
<RowGroup>
|
<RowGroup>
|
||||||
<label>
|
<label>
|
||||||
<SettingsRow title={t("Color theme")} subTitle={themeSubtitle}>
|
<SettingsRow title={t("Color theme")} subTitle={themeSubtitle}>
|
||||||
|
@ -65,7 +67,10 @@ const ColorSettings: FC = () => {
|
||||||
/>
|
/>
|
||||||
</SettingsRow>
|
</SettingsRow>
|
||||||
</label>
|
</label>
|
||||||
|
</RowGroup>
|
||||||
|
|
||||||
|
<Grid direction="row">
|
||||||
|
<RowGroup>
|
||||||
<label>
|
<label>
|
||||||
<SettingsRow title={t("Background")}>
|
<SettingsRow title={t("Background")}>
|
||||||
<input
|
<input
|
||||||
|
@ -105,7 +110,9 @@ const ColorSettings: FC = () => {
|
||||||
/>
|
/>
|
||||||
</SettingsRow>
|
</SettingsRow>
|
||||||
</label>
|
</label>
|
||||||
|
</RowGroup>
|
||||||
|
|
||||||
|
<RowGroup>
|
||||||
<label>
|
<label>
|
||||||
<SettingsRow title={t("Heading 1")}>
|
<SettingsRow title={t("Heading 1")}>
|
||||||
<input
|
<input
|
||||||
|
@ -156,6 +163,8 @@ const ColorSettings: FC = () => {
|
||||||
</SettingsRow>
|
</SettingsRow>
|
||||||
</label>
|
</label>
|
||||||
</RowGroup>
|
</RowGroup>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue