feat: add shared infiplot workspace packages
Signed-off-by: baizhi958216 <1475289190@qq.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "@infiplot/ui",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"react-native": "./src/index.native.tsx",
|
||||
"types": "./src/index.ts",
|
||||
"default": "./src/index.web.tsx"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=19",
|
||||
"react-native": ">=0.85"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "~19.2.2",
|
||||
"react-native": "0.85.3",
|
||||
"typescript": "^6.0.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export type { SurfaceProps } from "./surface.types";
|
||||
export { Surface } from "./surface.native";
|
||||
@@ -0,0 +1 @@
|
||||
export type { SurfaceProps } from "./surface.types";
|
||||
@@ -0,0 +1,2 @@
|
||||
export type { SurfaceProps } from "./surface.types";
|
||||
export { Surface } from "./surface.web";
|
||||
@@ -0,0 +1,16 @@
|
||||
import { View } from "react-native";
|
||||
import type { ViewStyle } from "react-native";
|
||||
import type { SurfaceProps } from "./surface.types";
|
||||
|
||||
const styles: Record<NonNullable<SurfaceProps["tone"]>, ViewStyle> = {
|
||||
default: {
|
||||
backgroundColor: "#ffffff"
|
||||
},
|
||||
muted: {
|
||||
backgroundColor: "#f4f6f8"
|
||||
}
|
||||
};
|
||||
|
||||
export function Surface({ children, tone = "default" }: SurfaceProps) {
|
||||
return <View style={styles[tone]}>{children}</View>;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export interface SurfaceProps {
|
||||
children: ReactNode;
|
||||
tone?: "default" | "muted";
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { CSSProperties } from "react";
|
||||
import type { SurfaceProps } from "./surface.types";
|
||||
|
||||
const styles: Record<NonNullable<SurfaceProps["tone"]>, CSSProperties> = {
|
||||
default: {
|
||||
backgroundColor: "#ffffff",
|
||||
color: "#111827"
|
||||
},
|
||||
muted: {
|
||||
backgroundColor: "#f4f6f8",
|
||||
color: "#111827"
|
||||
}
|
||||
};
|
||||
|
||||
export function Surface({ children, tone = "default" }: SurfaceProps) {
|
||||
return <div style={styles[tone]}>{children}</div>;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
||||
}
|
||||
Reference in New Issue
Block a user