[Refactor] Move to src-ui/views and src-ui/logics structure.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import styles from "./SidebarSection.module.scss";
|
||||
|
||||
export const SidebarSection = () => {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className={styles.scroll_container}>
|
||||
<div className={styles.tabs_wrapper}>
|
||||
<Tab tab_id="device" />
|
||||
<Tab tab_id="appearance" />
|
||||
<Tab tab_id="translation" />
|
||||
<Tab tab_id="transcription" />
|
||||
<Tab tab_id="vr" />
|
||||
<Tab tab_id="others" />
|
||||
<Tab tab_id="hotkeys" />
|
||||
<Tab tab_id="plugins" />
|
||||
<Tab tab_id="advanced_settings" />
|
||||
</div>
|
||||
<div className={styles.separated_tabs_wrapper}>
|
||||
<Tab tab_id="supporters" />
|
||||
<Tab tab_id="about_vrct" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
import clsx from "clsx";
|
||||
import { useI18n } from "@useI18n";
|
||||
import { useStore_SelectedConfigTabId } from "@store";
|
||||
|
||||
const Tab = (props) => {
|
||||
const { t } = useI18n();
|
||||
const { updateSelectedConfigTabId, currentSelectedConfigTabId } = useStore_SelectedConfigTabId();
|
||||
const onclickFunction = () => {
|
||||
updateSelectedConfigTabId(props.tab_id);
|
||||
};
|
||||
|
||||
const tab_container_class_names = clsx(styles["tab_container"], {
|
||||
[styles["is_selected"]]: (currentSelectedConfigTabId.data === props.tab_id) ? true : false
|
||||
});
|
||||
const switch_indicator_class_names = clsx(styles["switch_indicator"], {
|
||||
[styles["is_selected"]]: (currentSelectedConfigTabId.data === props.tab_id) ? true : false
|
||||
});
|
||||
|
||||
const getLabel = () => {
|
||||
if (props.tab_id === "vr") return "VR";
|
||||
if (props.tab_id === "supporters") return (
|
||||
<>Supporters<span className={styles.crown_emoji}>👑</span></>
|
||||
);
|
||||
if (props.tab_id === "about_vrct") return "About VRCT";
|
||||
return t(`config_page.side_menu_labels.${props.tab_id}`);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={tab_container_class_names} onClick={onclickFunction}>
|
||||
<p className={styles.tab_text}>{getLabel()}</p>
|
||||
<div className={switch_indicator_class_names}></div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,79 @@
|
||||
.container {
|
||||
width: var(--config_page_sidebar_width);
|
||||
flex-shrink: 0;
|
||||
padding: 0rem 0rem 5.8rem 1.2rem;
|
||||
}
|
||||
|
||||
.scroll_container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
overflow-y: auto;
|
||||
// overflow-x: hidden;
|
||||
height: 100%;
|
||||
max-height: 60rem;
|
||||
}
|
||||
|
||||
.tabs_wrapper {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.1rem;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.tab_container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
align-items: center;
|
||||
padding: 0.8rem 0 0.8rem 1rem;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background-color: var(--dark_800_color);
|
||||
}
|
||||
&:active {
|
||||
background-color: var(--dark_900_color);
|
||||
}
|
||||
&.is_selected {
|
||||
background-color: inherit;
|
||||
color: var(--primary_200_color);
|
||||
cursor: default;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
.switch_indicator {
|
||||
display: none;
|
||||
&.is_selected {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0rem;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 0.2rem;
|
||||
height: 2.6rem;
|
||||
border-radius: 0.1rem;
|
||||
background-color: var(--primary_300_color);
|
||||
}
|
||||
}
|
||||
|
||||
.tab_text {
|
||||
// overflow: hidden;
|
||||
font-size: 1.6rem;
|
||||
// text-overflow: ellipsis;
|
||||
position: relative;
|
||||
}
|
||||
.crown_emoji {
|
||||
font-size: 1.6rem;
|
||||
position: absolute;
|
||||
top: 40%;
|
||||
left: 100%;
|
||||
transform: translateY(-50%);
|
||||
padding-left: 0.4rem;
|
||||
}
|
||||
|
||||
.separated_tabs_wrapper {
|
||||
// padding-bottom: 1.2rem;
|
||||
}
|
||||
Reference in New Issue
Block a user