From 116dde80110bab90f0e41db93f0ff403115f518e Mon Sep 17 00:00:00 2001 From: Vladimir Jimenez Date: Sun, 1 May 2022 15:47:45 -0700 Subject: [PATCH] Make BZDB Settings scrollable vertically --- .../Modals/BZDBSettingsModal.module.scss | 9 +++++++ src/Components/Modals/BZDBSettingsModal.tsx | 14 ++++++----- src/Components/TabList.module.scss | 5 ++++ src/Components/TabList.tsx | 24 +++++++++++++++---- 4 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 src/Components/Modals/BZDBSettingsModal.module.scss diff --git a/src/Components/Modals/BZDBSettingsModal.module.scss b/src/Components/Modals/BZDBSettingsModal.module.scss new file mode 100644 index 0000000..6238875 --- /dev/null +++ b/src/Components/Modals/BZDBSettingsModal.module.scss @@ -0,0 +1,9 @@ +.modalBody { + display: flex; +} + +.tabList { + [data-role='tab-list'] { + width: 300px; + } +} diff --git a/src/Components/Modals/BZDBSettingsModal.tsx b/src/Components/Modals/BZDBSettingsModal.tsx index fe43625..fab3c16 100644 --- a/src/Components/Modals/BZDBSettingsModal.tsx +++ b/src/Components/Modals/BZDBSettingsModal.tsx @@ -22,6 +22,7 @@ import { Tab, TabList } from '../TabList'; import BZDBDocs from '../../data/bzdb-documention.json'; import generalStyles from '../../sass/general.module.scss'; +import styles from './BZDBSettingsModal.module.scss'; type BZDBVariableType = typeof BZDBDocs.variables[number]; @@ -168,13 +169,19 @@ const BZDBSettingsModal = () => { return ( + Save + + } title="BZDB Settings" onOpen={syncStateToWorld} hideOnEsc={false} hideOnClickOutside={false} > - + {bzdbCategories.map((category) => ( {bzdbDefinitionsByCategory[category].map((variable) => ( @@ -187,11 +194,6 @@ const BZDBSettingsModal = () => { ))} -
- -
); }; diff --git a/src/Components/TabList.module.scss b/src/Components/TabList.module.scss index 0350eb6..5c2f028 100644 --- a/src/Components/TabList.module.scss +++ b/src/Components/TabList.module.scss @@ -7,6 +7,8 @@ } .container { + width: 100%; + &[data-vertical='true'] { display: flex; } @@ -20,10 +22,12 @@ @include is-vertical(true) { border-right: 1px solid white; + overflow-y: auto; } @include is-vertical(false) { border-bottom: 1px solid white; + overflow-x: auto; } } @@ -72,6 +76,7 @@ } .panelContainer { + overflow-y: auto; width: 100%; } diff --git a/src/Components/TabList.tsx b/src/Components/TabList.tsx index f41e091..dfed5e3 100644 --- a/src/Components/TabList.tsx +++ b/src/Components/TabList.tsx @@ -6,6 +6,8 @@ import { useTabState, } from 'reakit'; +import { classList } from '../Utilities/cssClasses'; + import styles from './TabList.module.scss'; interface TabProps { @@ -16,23 +18,37 @@ interface TabProps { const Tab = ({ children }: TabProps) => <>{children}; interface TabListProps { + className?: string; vertical?: boolean; children: ReactElement | ReactElement[]; } -const TabList = ({ vertical = false, children, ...props }: TabListProps) => { +const TabList = ({ + className, + vertical = false, + children, + ...props +}: TabListProps) => { const tab = useTabState(); return ( -
- +
+ {React.Children.map(children, (child) => ( {child.props.title} ))} -
+
{React.Children.map(children, (child) => ( {child.props.children}