From aee42694062c9c979fd1df301180f4f555083049 Mon Sep 17 00:00:00 2001 From: Pavel Prichodko <14926950+prichodko@users.noreply.github.com> Date: Tue, 17 Jan 2023 14:32:04 +0100 Subject: [PATCH] add icons package --- packages/icons/package.json | 28 +++++++++++++++++++++ packages/icons/src/index.tsx | 2 ++ packages/icons/src/members-icon.tsx | 29 +++++++++++++++++++++ packages/icons/src/options-icon.tsx | 20 +++++++++++++++ packages/icons/src/types.ts | 6 +++++ packages/icons/tsconfig.json | 9 +++++++ packages/icons/vite.config.ts | 39 +++++++++++++++++++++++++++++ 7 files changed, 133 insertions(+) create mode 100644 packages/icons/package.json create mode 100644 packages/icons/src/index.tsx create mode 100644 packages/icons/src/members-icon.tsx create mode 100644 packages/icons/src/options-icon.tsx create mode 100644 packages/icons/src/types.ts create mode 100644 packages/icons/tsconfig.json create mode 100644 packages/icons/vite.config.ts diff --git a/packages/icons/package.json b/packages/icons/package.json new file mode 100644 index 00000000..ff22cfbd --- /dev/null +++ b/packages/icons/package.json @@ -0,0 +1,28 @@ +{ + "name": "@status-im/icons", + "version": "0.0.1", + "types": "src/index.tsx", + "main": "src/index.tsx", + "private": true, + "files": [ + "types", + "dist" + ], + "scripts": { + "dev": "vite build --watch --mode development", + "build": "vite build", + "postbuild": "yarn typegen", + "#test": "vitest", + "typecheck": "tsc", + "typegen": "tsc --noEmit false --emitDeclarationOnly || true", + "lint": "eslint src", + "format": "prettier --write src", + "clean": "rm -rf dist node_modules .turbo" + }, + "peerDependencies": { + "react": "^16.x || ^17.x || ^18.x" + }, + "devDependencies": { + "vite": "^4.0.4" + } +} diff --git a/packages/icons/src/index.tsx b/packages/icons/src/index.tsx new file mode 100644 index 00000000..e4471c39 --- /dev/null +++ b/packages/icons/src/index.tsx @@ -0,0 +1,2 @@ +export { MembersIcon } from './members-icon' +export { OptionsIcon } from './options-icon' diff --git a/packages/icons/src/members-icon.tsx b/packages/icons/src/members-icon.tsx new file mode 100644 index 00000000..a5eb5976 --- /dev/null +++ b/packages/icons/src/members-icon.tsx @@ -0,0 +1,29 @@ +import type { IconProps } from './types' + +export function MembersIcon(props: IconProps) { + const { color = 'currentColor', ...rest } = props + + return ( + + + + + ) +} diff --git a/packages/icons/src/options-icon.tsx b/packages/icons/src/options-icon.tsx new file mode 100644 index 00000000..e9cda24d --- /dev/null +++ b/packages/icons/src/options-icon.tsx @@ -0,0 +1,20 @@ +import type { IconProps } from './types' + +export function OptionsIcon(props: IconProps) { + const { color = 'currentColor', ...rest } = props + + return ( + + + + + + ) +} diff --git a/packages/icons/src/types.ts b/packages/icons/src/types.ts new file mode 100644 index 00000000..b844e9a0 --- /dev/null +++ b/packages/icons/src/types.ts @@ -0,0 +1,6 @@ +import type { SVGAttributes } from 'react' + +export interface IconProps extends SVGAttributes { + children?: never + color?: string +} diff --git a/packages/icons/tsconfig.json b/packages/icons/tsconfig.json new file mode 100644 index 00000000..bbbb84f2 --- /dev/null +++ b/packages/icons/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["src"], + "compilerOptions": { + "outDir": "./dist", + "declarationDir": "dist/types", + "resolveJsonModule": true + } +} diff --git a/packages/icons/vite.config.ts b/packages/icons/vite.config.ts new file mode 100644 index 00000000..8595de6d --- /dev/null +++ b/packages/icons/vite.config.ts @@ -0,0 +1,39 @@ +/// + +import react from '@vitejs/plugin-react' +import { defineConfig } from 'vite' + +import { peerDependencies } from './package.json' + +const external = [ + // ...Object.keys(dependencies || {}), + ...Object.keys(peerDependencies || {}), +].map(name => new RegExp(`^${name}(/.*)?`)) + +export default defineConfig(({ mode }) => { + return { + build: { + target: 'es2020', + lib: { + entry: './src/index.tsx', + fileName: 'index', + formats: ['es'], + }, + sourcemap: true, + emptyOutDir: mode === 'production', + rollupOptions: { + external, + }, + }, + + plugins: [react()], + + // plugins: [ + // react(), + // ], + + test: { + environment: 'happy-dom', + }, + } +})