silverwolf-x's picture
download
raw
1.15 kB
"use client";
import React, { useContext, createContext } from "react";
import { VerticalPadding, VerticalPaddingOptions } from "../VerticalPadding";
import classes from "./index.module.scss";
type BackgroundColorField = "white" | "black";
export const BackgroundColorContext =
createContext<BackgroundColorField>("white");
export const useBackgroundColor = (): BackgroundColorField =>
useContext(BackgroundColorContext);
type Props = {
color?: BackgroundColorField;
paddingTop?: VerticalPaddingOptions;
paddingBottom?: VerticalPaddingOptions;
className?: string;
children?: React.ReactNode;
id?: string;
};
export const BackgroundColor: React.FC<Props> = (props) => {
const {
id,
className,
children,
paddingTop,
paddingBottom,
color = "white",
} = props;
return (
<div
id={id}
className={[classes[color], className].filter(Boolean).join(" ")}
>
<BackgroundColorContext.Provider value={color}>
<VerticalPadding top={paddingTop} bottom={paddingBottom}>
{children}
</VerticalPadding>
</BackgroundColorContext.Provider>
</div>
);
};

Xet Storage Details

Size:
1.15 kB
·
Xet hash:
9c62c817efb7e25a20733726e353b1a1a24307ce50114785ddaf3999ad8a2f36

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.