Leftover type safety

This commit is contained in:
Zoe Roux
2022-11-09 14:58:24 +09:00
parent 56689834a9
commit 3c114f0da5
2 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -5,10 +5,10 @@
import Head from "next/head";
import Image from "next/image";
import { useYoshiki } from "@yoshiki/react";
import { useYoshiki, Stylable } from "@yoshiki/react";
import { ReactNode } from "react";
const Box = ({ children, ...props }: { children?: ReactNode }) => {
const Box = ({ children, ...props }: { children?: ReactNode } & Stylable) => {
const { css } = useYoshiki();
return (
+7 -2
View File
@@ -5,7 +5,7 @@
import { Properties } from "csstype";
import { Theme, YoshikiStyle, useTheme, breakpoints, isBreakpoints } from "@yoshiki/core";
import { useInsertionEffect } from "react";
import { CSSProperties, useInsertionEffect } from "react";
// TODO: shorthands
export type CssObject = {
@@ -58,7 +58,7 @@ export const useYoshiki = () => {
return {
css: (
css: CssObject /* | CssObject[] */,
leftOverProps?: { className?: string; style?: Properties },
leftOverProps?: { className?: string; style?: CSSProperties },
) => {
const { className, style, ...leftOver } = leftOverProps ?? {};
@@ -82,3 +82,8 @@ export const useYoshiki = () => {
theme,
};
};
export type Stylable = {
className?: string,
style?: CSSProperties,
}