import type { ReactNode } from "react";
import type {
Accent,
AccentOrNeutral,
AlouetteModeTheme,
} from "../../core/AlouetteConfig";
import { AccentScope } from "../containers/AccentScope";
import { Box } from "../containers/Box";
import { ScopedTheme } from "../containers/ScopedTheme";
import { ScrollView } from "../primitives/ScrollView";
import { View } from "../primitives/View";
import { styled } from "../styled";
import { StoryTitle } from "./StoryTitle";
export interface StorySectionProps {
title: ReactNode;
children: ReactNode;
level?: 1 | 2;
modeTheme?: AlouetteModeTheme;
accent?: AccentOrNeutral;
withSurface?: boolean;
}
const InternalStorySection = styled(View, "-mx-l px-l");
function StorySection({
title,
children,
level = 1,
modeTheme,
accent,
withSurface = false,
}: StorySectionProps): ReactNode {
const content = (
{withSurface ? (
{title}
{children}
) : (
<>
{title}
{children}
>
)}
);
if (modeTheme) {
return {content};
}
if (accent) {
return {content};
}
return content;
}
function StorySubSection({
title,
children,
modeTheme,
accent,
withSurface = false,
}: StorySectionProps): ReactNode {
const content = (
{withSurface ? (
{title}
{children}
) : (
<>
{title}
{children}
>
)}
);
if (modeTheme) {
return {content};
}
if (accent) {
return {content};
}
return content;
}
// const SimpleWebScrollView = styled(View, "h-full overflow-auto");
export interface StoryProps {
documentation?: NonNullable;
children?: NonNullable;
noDarkMode?: boolean;
}
export function Story({
documentation,
children,
noDarkMode,
}: StoryProps): ReactNode {
return (
{documentation ? (
{documentation}
) : null}
{(["light", ...(noDarkMode ? [] : ["dark"])] as ("dark" | "light")[]).map(
(mode) => (
{children}
),
)}
);
}
Story.Section = StorySection;
Story.SubSection = StorySubSection;
export const accentsWithoutNeutral: Accent[] = [
"brand",
"danger",
"info",
"success",
"warning",
];
export const neutralAndAccents: AccentOrNeutral[] = [
"neutral",
...accentsWithoutNeutral,
];