aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'FrontEnd/src/views')
-rw-r--r--FrontEnd/src/views/settings/index.tsx104
-rw-r--r--FrontEnd/src/views/timeline/Timeline.css4
2 files changed, 62 insertions, 46 deletions
diff --git a/FrontEnd/src/views/settings/index.tsx b/FrontEnd/src/views/settings/index.tsx
index 8110002b..633bb209 100644
--- a/FrontEnd/src/views/settings/index.tsx
+++ b/FrontEnd/src/views/settings/index.tsx
@@ -16,6 +16,7 @@ import ChangeAvatarDialog from "./ChangeAvatarDialog";
import ChangeNicknameDialog from "./ChangeNicknameDialog";
import "./index.css";
+import classNames from "classnames";
interface SettingSectionProps {
title: I18nText;
@@ -35,91 +36,106 @@ const SettingSection: React.FC<SettingSectionProps> = ({ title, children }) => {
);
};
-interface ButtonSettingItemProps {
+interface SettingItemContainerWithoutChildrenProps {
title: I18nText;
subtext?: I18nText;
- onClick: () => void;
first?: boolean;
danger?: boolean;
+ style?: React.CSSProperties;
+ className?: string;
+ onClick?: () => void;
}
-const ButtonSettingItem: React.FC<ButtonSettingItemProps> = ({
+interface SettingItemContainerProps
+ extends SettingItemContainerWithoutChildrenProps {
+ children?: React.ReactNode;
+}
+
+function SettingItemContainer({
title,
subtext,
- onClick,
first,
danger,
-}) => {
+ children,
+ style,
+ className,
+ onClick,
+}: SettingItemContainerProps): JSX.Element {
const { t } = useTranslation();
return (
<div
+ style={style}
className={classnames(
- "settings-item clickable",
+ "row settings-item mx-0",
first && "first",
- danger && "cru-color-danger"
+ className
)}
- onClick={onClick}
>
- {convertI18nText(title, t)}
- {subtext && (
+ <div className="px-0 col col-12 col-sm-auto" onClick={onClick}>
+ <div className={classNames(danger && "cru-color-danger")}>
+ {convertI18nText(title, t)}
+ </div>
<small className="d-block cru-color-secondary">
{convertI18nText(subtext, t)}
</small>
- )}
+ </div>
+ <div className="col col-12 col-sm-auto">{children}</div>
</div>
);
+}
+
+type ButtonSettingItemProps = SettingItemContainerWithoutChildrenProps;
+
+const ButtonSettingItem: React.FC<ButtonSettingItemProps> = ({
+ className,
+ ...props
+}) => {
+ return (
+ <SettingItemContainer
+ className={classNames("clickable", className)}
+ {...props}
+ />
+ );
};
-interface SelectSettingItemProps {
- title: I18nText;
- subtext?: I18nText;
+interface SelectSettingItemProps
+ extends SettingItemContainerWithoutChildrenProps {
options: {
value: string;
label: I18nText;
}[];
value?: string;
onSelect: (value: string) => void;
- first?: boolean;
}
const SelectSettingsItem: React.FC<SelectSettingItemProps> = ({
- title,
- subtext,
options,
value,
onSelect,
- first,
+ ...props
}) => {
const { t } = useTranslation();
return (
- <div className={classnames("row settings-item mx-0", first && "first")}>
- <div className="px-0 col col-12 col-sm-auto">
- <div>{convertI18nText(title, t)}</div>
- <small className="d-block cru-color-secondary">
- {convertI18nText(subtext, t)}
- </small>
- </div>
- <div className="col col-12 col-sm-auto">
- {value == null ? (
- <Spinner />
- ) : (
- <select
- value={value}
- onChange={(e) => {
- onSelect(e.target.value);
- }}
- >
- {options.map(({ value, label }) => (
- <option key={value} value={value}>
- {convertI18nText(label, t)}
- </option>
- ))}
- </select>
- )}
- </div>
- </div>
+ <SettingItemContainer {...props}>
+ {value == null ? (
+ <Spinner />
+ ) : (
+ <select
+ value={value}
+ onChange={(e) => {
+ onSelect(e.target.value);
+ }}
+ >
+ {options.map(({ value, label }) => (
+ <option key={value} value={value}>
+ {convertI18nText(label, t)}
+ </option>
+ ))}
+ </select>
+ )}
+ </SettingItemContainer>
);
};
diff --git a/FrontEnd/src/views/timeline/Timeline.css b/FrontEnd/src/views/timeline/Timeline.css
index b65ab3a0..4dd4fdcc 100644
--- a/FrontEnd/src/views/timeline/Timeline.css
+++ b/FrontEnd/src/views/timeline/Timeline.css
@@ -4,7 +4,7 @@
width: 100%;
}
-@keyframes timeline-line-node-noncurrent {
+@keyframes timeline-line-node {
to {
box-shadow: 0 0 20px 3px var(--cru-primary-l1-color);
}
@@ -103,7 +103,7 @@
box-sizing: border-box;
z-index: 1;
animation: 1s infinite alternate;
- animation-name: timeline-line-node-noncurrent;
+ animation-name: timeline-line-node;
}
.timeline-line .node-loading-edge {
color: var(--cru-primary-color);