feat: Added ScrollableContainer for pages with a sidebarg

This commit is contained in:
LynithDev 2024-05-16 19:45:13 +02:00
parent a970ed27a5
commit e8fa840aff
3 changed files with 61 additions and 3 deletions

View file

@ -0,0 +1,23 @@
import { OverlayScrollbarsComponent } from 'overlayscrollbars-solid';
import type { ParentProps } from 'solid-js';
type ScrollableContainerProps = ParentProps & {
title: string;
};
function ScrollableContainer(props: ScrollableContainerProps) {
return (
<div class="flex flex-col flex-1">
<h1>{props.title}</h1>
<div class="flex flex-col flex-1 rounded-lg overflow-hidden w-[calc(100%+14px)]">
<OverlayScrollbarsComponent class="os-hide-horizontal-scrollbar relative flex-1">
<div class="flex flex-col absolute w-[calc(100%-14px)] gap-2">
{props.children}
</div>
</OverlayScrollbarsComponent>
</div>
</div>
);
}
export default ScrollableContainer;

View file

@ -0,0 +1,31 @@
import { type JSX, type ParentProps, createEffect } from 'solid-js';
type SettingsRowProps = ParentProps & {
title: string;
description: string;
icon: JSX.Element;
clickable?: () => any;
};
function SettingsRow(props: SettingsRowProps) {
const interactableClass = createEffect(() => props.clickable ? 'hover:bg-component-bg-hover active:bg-component-bg-pressed' : '');
return (
<div class={`flex flex-row bg-component-bg rounded-xl gap-4 p-4 ${interactableClass} items-center`}>
<div class="flex justify-center items-center h-8 w-8">
{props.icon}
</div>
<div class="flex flex-col gap-1 flex-1">
<h3>{props.title}</h3>
<p class="text-wrap">{props.description}</p>
</div>
<div class="">
<span>test</span>
</div>
</div>
);
}
export default SettingsRow;

View file

@ -1,8 +1,12 @@
import { Code01Icon } from '@untitled-theme/icons-solid';
import SettingsRow from '../components';
import ScrollableContainer from '~ui/components/ScrollableContainer';
function SettingsGeneral() {
return (
<div>
<h1>General</h1>
</div>
<ScrollableContainer title="General">
<SettingsRow title="Title" description="In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the" icon={<Code01Icon />} />
</ScrollableContainer>
);
}