diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 84a20a0..0000000 --- a/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["babel-plugin-styled-components"] -} diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index f65bf22..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "env": { - "es6": true, - "browser": true, - "node": true - }, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 2020, - "sourceType": "module", - "ecmaFeatures": { - "jsx": true - } - }, - "extends": [ - "eslint:recommended", - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "plugin:import/recommended", - "plugin:import/react", - "plugin:security/recommended", - "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended", - "prettier" - ], - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "plugins": [ - "react", - "react-hooks", - "security", - "import" - ], - "ignorePatterns": ["src/assets"], - "settings": { - "react": { - "version": "^16.12.0" - }, - "import/resolver": { - "parcel": { - "rootDir": "src", - "extensions": [ - ".js", - ".jsx", - ".ts", - ".tsx", - ".svg", - ".png", - ".jpeg" - ] - } - } - }, - "rules": { - "max-len": ["warn", {"code": 80}], - "react/prop-types": 0, - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - "varsIgnorePattern": "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)", - "argsIgnorePattern": "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)" - } - ], - "no-console": [ - "error", - { - "allow": [ - "warn", - "error", - "info", - "debug" - ] - } - ], - "@typescript-eslint/no-explicit-any": ["off"], - "security/detect-object-injection": "off", - "security/detect-non-literal-fs-filename": "off", - "import/extensions": [ - "error", - "ignorePackages", - { - "js": "never", - "jsx": "never", - "ts": "never", - "tsx": "never" - } - ] - } -} diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index d3237a7..ccc516c 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -1,13 +1,15 @@ name: ESLint on: pull_request: - branches: [ main ] + branches: [main] jobs: eslint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install modules - run: yarn - - name: Run ESLint - run: yarn check-style + - uses: actions/checkout@v2 + - name: Enable corepack + run: corepack enable + - name: Install modules + run: yarn + - name: Run ESLint + run: yarn check-style diff --git a/.github/workflows/tsc.yml b/.github/workflows/tsc.yml index 543778e..decfc29 100644 --- a/.github/workflows/tsc.yml +++ b/.github/workflows/tsc.yml @@ -1,13 +1,15 @@ name: TypeCheck on: pull_request: - branches: [ main ] + branches: [main] jobs: TypeScriptCompiler: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install modules - run: yarn - - name: Run TypeScriptCompiler - run: yarn check-types + - uses: actions/checkout@v2 + - name: Enable corepack + run: corepack enable + - name: Install modules + run: yarn + - name: Run TypeScriptCompiler + run: yarn check-types diff --git a/.gitignore b/.gitignore index 1b49eb5..4f32d1e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,12 +6,9 @@ /.pnp.* node_modules -# parcel -.parcel-cache development build dist -parcel-bundle-reports # misc .eslintcache @@ -26,3 +23,5 @@ parcel-bundle-reports npm-debug.log* yarn-debug.log* yarn-error.log* + +*storybook.log diff --git a/.lintstagedrc.json b/.lintstagedrc.json index b6e5efd..9fc6f7f 100644 --- a/.lintstagedrc.json +++ b/.lintstagedrc.json @@ -1,3 +1,3 @@ { - "**/*.{js,jsx,ts,tsx}": ["eslint"] + "**/*.{js,jsx,ts,tsx}": ["eslint --fix"] } diff --git a/.parcelrc b/.parcelrc deleted file mode 100644 index e0a9df9..0000000 --- a/.parcelrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "@parcel/config-default", - "transformers": { - "**/*.svg": ["...", "@parcel/transformer-svg-react"] - } -} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..b4bfed3 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "plugins": ["prettier-plugin-tailwindcss"] +} diff --git a/.storybook/main.ts b/.storybook/main.ts new file mode 100644 index 0000000..0a9643d --- /dev/null +++ b/.storybook/main.ts @@ -0,0 +1,41 @@ +import type { StorybookConfig } from "@storybook/react-vite"; + +const config: StorybookConfig = { + stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], + addons: [ + "@storybook/addon-essentials", + "@storybook/addon-onboarding", + "@chromatic-com/storybook", + "@storybook/addon-interactions", + ], + framework: { + name: "@storybook/react-vite", + options: {}, + }, + typescript: { + reactDocgen: "react-docgen-typescript", + reactDocgenTypescriptOptions: { + propFilter: (prop) => { + if (prop.parent) { + const fileName = prop.parent.fileName; + // Include props from our own code (not in node_modules) + if (!fileName.includes("node_modules")) { + return true; + } + // Include props from react-aria-components and react-aria + if ( + fileName.includes("react-aria-components") || + fileName.includes("react-aria") || + fileName.includes("node_modules/@react-types") + ) { + return true; + } + // Exclude all other props from node_modules + return false; + } + return true; + }, + }, + }, +}; +export default config; diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx new file mode 100644 index 0000000..cfa88da --- /dev/null +++ b/.storybook/preview.tsx @@ -0,0 +1,54 @@ +import React, { useEffect } from "react"; +import clsx from "clsx"; + +import type { Preview } from "@storybook/react"; + +import "../src/styles/global.css"; + +export type IPreviewArgs = { + themeUI: "light" | "dark"; + backgroundUI: "white" | "light"; +}; + +const preview: Preview = { + decorators: [ + (Story, { args }) => { + const { themeUI, backgroundUI } = args; + useEffect(() => { + if (themeUI === "dark") document.documentElement.classList.add("dark"); + else document.documentElement.classList.remove("dark"); + }, [themeUI]); + return ( +
+ +
+ ); + }, + ], + args: { + themeUI: "light", + backgroundUI: "white", + }, + argTypes: { + themeUI: { + options: ["light", "dark"], + control: { type: "radio" }, + }, + backgroundUI: { + options: ["white", "light"], + control: { type: "radio" }, + }, + }, + parameters: { + layout: "centered", + }, +}; + +export default preview; diff --git a/README.md b/README.md index fe5559f..c812645 100644 --- a/README.md +++ b/README.md @@ -14,39 +14,182 @@ ## Introduction -**[📖 Storybook](https://www.figma.com/file/b7DEUKDeHlOl4ocDTMv7UIhZ/Kleros?node-id=7515%3A9807)** +The Kleros UI Components Library is a comprehensive collection of React components that implement the Kleros design system. This library provides a consistent and accessible user interface for Kleros applications, making it easier to build cohesive user experiences across the Kleros ecosystem. -**[👨‍🎨 Figma](https://www.figma.com/file/b7DEUKDeHlOl4ocDTMv7UIhZ/Kleros?node-id=7515%3A9807)** +Built with React, TypeScript, and Tailwind CSS, this library offers a wide range of components from basic UI elements to complex interactive widgets. Each component is designed with accessibility, customization, and ease of use in mind. + +## Features + +- **React-based components**: Built with React 18 and TypeScript for type safety +- **Tailwind CSS integration**: Leverages Tailwind for styling with consistent design tokens +- **Accessibility**: Components follow WAI-ARIA guidelines for maximum accessibility +- **Responsive design**: Components adapt to different screen sizes +- **Customizable**: Easily theme and extend components to match your application's design +- **Storybook documentation**: Interactive documentation with usage examples + +## Components + +The library includes a wide variety of components, including but not limited to: + +- **Layout**: Box, Card, Modal +- **Navigation**: Breadcrumb, Pagination, Tabs +- **Form Elements**: TextField, TextArea, NumberField, Checkbox, RadioGroup, Switch, DatePicker, FileUploader +- **Data Display**: DisplaySmall, DisplayLarge, DisplayIcon, Tag, Tooltip +- **Feedback**: Alert, Push Notifications +- **Progress**: LinearProgress, CircularProgress, Steps, Timeline +- **Interactive Elements**: Button, Accordion, Dropdown, Cascader ## Usage -#### Install the package -With `yarn add @kleros/ui-components-library` or `npm install @kleros/ui-components-library` +### Installation + +Install the package using your preferred package manager: + +```bash +# Using yarn +yarn add @kleros/ui-components-library -#### Create a theme file -Wwhere you destructure `lightTheme` or `darkTheme` (or both) in your theme object to provide the correct colors to the components. ([example](https://github.com/kleros/kleros-v2/blob/dev/web/src/styles/themes.ts)). +# Using npm +npm install @kleros/ui-components-library +``` -#### Provide the theme -With styled-components `ThemeProvider` ([example](https://github.com/kleros/kleros-v2/blob/dev/web/src/context/StyledComponentsProvider.tsx)). +### Setup -## Package Publication +1. Import the CSS at the top level of your application: -#### Tagging -1. Bump the version in `package.json` -1. Run a clean build: `yarn clean && yarn build` -1. Commit the change to git: `git add -u ; git commit -m "chore: release"` -1. Tag this version: `version=v$(cat package.json | jq -r .version) && git tag -m $version $version` -1. Push both commit and tag: `git push && git push --tags` +```javascript +import "@kleros/ui-components-library/style.css"; +``` + +2. Import and use components in your application: + +```jsx +import { Button, TextField, Alert } from "@kleros/ui-components-library"; + +function MyComponent() { + return ( +
+ + + Operation completed successfully! +
+ ); +} +``` + +### Theme usage + +If you wish the use the library's tailwind theme variables in your tailwind app. You can utilize it by importing the theme file in your `global.css` file. + +```css +@import tailwindcss @import + "../../../node_modules/@kleros/ui-components-library/dist/theme/theme.css"; +``` + +You can find the available theme variables [here](src/styles/theme.css). +If want to override or edit the defined theme variables, you can do so like this: + +```css +:root { + --klerosUIComponentsWhiteBackground: #832323; +} +:root[class="dark"] { + --klerosUIComponentsWhiteBackground: #832323; +} +``` + +### Peer Dependencies + +This library requires the following peer dependencies: + +- React 18+ +- React DOM 18+ +- Tailwind CSS 4+ + +Make sure these are installed in your project. + +## Development -#### Publish to NPM -1. Export your NPM token: ` export YARN_NPM_AUTH_TOKEN=` -1. Publish: `yarn publish` +### Local Setup + +1. Clone the repository: + + ```bash + git clone https://github.com/kleros/ui-components-library.git + cd ui-components-library + ``` + +2. Install dependencies: + + ```bash + yarn install + ``` + +3. Start the Storybook development server: + + ```bash + yarn start + ``` + +4. Build the library: + ```bash + yarn build + ``` + +### Code Quality + +This project uses: + +- TypeScript for type checking +- ESLint for code linting +- Prettier for code formatting +- Husky for Git hooks +- Conventional Commits for commit messages + +Run checks with: -#### Publish to Github -1. Login ```bash -npm login --registry https://npm.pkg.github.com --auth-type legacy -> Username: YOUR_GITHUB_USERNAME -> Password: YOUR_GITHUB_PERSONAL_ACCESS_TOKEN` +yarn check-types # Type checking +yarn check-style # Linting ``` + +## Package Publication + +### Tagging + +1. Bump the version in `package.json` +2. Run a clean build: `yarn clean && yarn build` +3. Commit the change to git: `git add -u ; git commit -m "chore: release"` +4. Tag this version: `version=v$(cat package.json | jq -r .version) && git tag -m $version $version` +5. Push both commit and tag: `git push && git push --tags` + +### Publish to NPM + +1. Export your NPM token: `export YARN_NPM_AUTH_TOKEN=` +2. Publish: `yarn publish` + +### Publish to GitHub + +1. Login: + + ```bash + npm login --registry https://npm.pkg.github.com --auth-type legacy + > Username: YOUR_GITHUB_USERNAME + > Password: YOUR_GITHUB_PERSONAL_ACCESS_TOKEN + ``` + 2. Publish: `npm publish --registry https://npm.pkg.github.com` + +## Contributing + +Contributions are welcome! Please feel free to submit a Pull Request. + +1. Fork the repository +2. Create your feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes using conventional commits (`git commit -m 'feat: add some amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. diff --git a/commitlint.config.js b/commitlint.config.cjs similarity index 100% rename from commitlint.config.js rename to commitlint.config.cjs diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..5a3d118 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,119 @@ +import { fixupConfigRules, fixupPluginRules } from "@eslint/compat"; +import react from "eslint-plugin-react"; +import reactHooks from "eslint-plugin-react-hooks"; +import security from "eslint-plugin-security"; +import _import from "eslint-plugin-import"; +import globals from "globals"; +// eslint-disable-next-line import/no-unresolved +import tsParser from "@typescript-eslint/parser"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +export default [ + { + ignores: ["src/assets"], + }, + ...fixupConfigRules( + compat.extends( + "eslint:recommended", + "plugin:react/recommended", + "plugin:react-hooks/recommended", + "plugin:import/recommended", + "plugin:import/react", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended", + "prettier", + "plugin:security/recommended-legacy", + ), + ), + { + plugins: { + react: fixupPluginRules(react), + "react-hooks": fixupPluginRules(reactHooks), + security: fixupPluginRules(security), + import: fixupPluginRules(_import), + }, + + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + Atomics: "readonly", + SharedArrayBuffer: "readonly", + }, + + parser: tsParser, + ecmaVersion: 2020, + sourceType: "module", + + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + }, + + settings: { + react: { + version: "^18.2.0", + }, + "import/resolver": { + node: { + extensions: [".js", ".jsx", ".ts", ".tsx"], + }, + }, + }, + + rules: { + "max-len": [ + "warn", + { + code: 120, + }, + ], + + "react/prop-types": 0, + "no-unused-vars": "off", + + "@typescript-eslint/no-unused-vars": [ + "error", + { + varsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)", + argsIgnorePattern: "(^_+[0-9]*$)|([iI]gnored$)|(^ignored)", + }, + ], + + "no-console": [ + "error", + { + allow: ["warn", "error", "info", "debug"], + }, + ], + + "@typescript-eslint/no-explicit-any": ["off"], + "security/detect-object-injection": "off", + "security/detect-non-literal-fs-filename": "off", + + "import/extensions": [ + "error", + "ignorePackages", + { + js: "never", + jsx: "never", + ts: "never", + tsx: "never", + }, + ], + }, + }, +]; diff --git a/global.d.ts b/global.d.ts deleted file mode 100644 index 1debe4a..0000000 --- a/global.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {} from "styled-components"; -import { lightTheme } from "./src/styles/themes"; - -declare global { - module "*.svg" { - const content: React.FunctionComponent>; - export default content; - } -} - -declare module "styled-components" { - type Theme = typeof lightTheme; - //eslint-disable-next-line @typescript-eslint/no-empty-interface - export interface DefaultTheme extends Theme {} -} diff --git a/src/index.html b/index.html similarity index 65% rename from src/index.html rename to index.html index 5472d89..0f263c8 100644 --- a/src/index.html +++ b/index.html @@ -3,10 +3,11 @@ + UI Components Library
- + diff --git a/package.json b/package.json index 4fe2782..79265df 100644 --- a/package.json +++ b/package.json @@ -1,80 +1,116 @@ { "name": "@kleros/ui-components-library", - "version": "2.20.0", + "version": "3.0.0", "description": "UI components library which implements the Kleros design system.", - "source": "src/lib/index.ts", - "main": "dist/index.js", - "types": "dist/types.d.ts", + "source": "./src/lib/index.ts", + "main": "./dist/esm/ui-components-library.js", + "module": "./dist/esm/ui-components-library.js", + "types": "./dist/ui-components-library.d.ts", + "style": "./dist/esm/ui-components-library.css", "isLibrary": true, + "type": "module", "browserslist": "> 0.5%, last 2 versions, not dead", "repository": "git@github.com:kleros/ui-components-library", "author": "Kleros", "license": "MIT", + "exports": { + ".": { + "import": "./dist/esm/ui-components-library.js", + "types": "./dist/ui-components-library.d.ts" + }, + "./style.css": "./dist/esm/ui-components-library.css", + "./theme.css": "./dist/theme/theme.css" + }, "scripts": { - "clear": "rm -r .parcel-cache", - "clean": "rm dist/bundle.js", - "start": "parcel src/index.html", - "build": "parcel build", - "prepare": "husky install", + "build:theme": "vite build --config vite.config.theme.js", + "build": "vite build && yarn build:theme", + "build-storybook": "storybook build", "check-style": "eslint 'src/**/*.{ts,tsx}'", - "check-types": "tsc --noEmit" + "check-types": "tsc --noEmit", + "clean": "rm -rf dist", + "prepare": "husky install", + "start": "storybook dev -p 6006" }, "files": [ "dist" ], "devDependencies": { + "@chromatic-com/storybook": "^3.2.5", "@commitlint/cli": "^15.0.0", "@commitlint/config-conventional": "^15.0.0", - "@parcel/packager-ts": "^2.2.1", - "@parcel/transformer-svg-react": "^2.0.1", - "@parcel/transformer-typescript-types": "^2.2.1", + "@eslint/compat": "^1.2.7", + "@eslint/eslintrc": "^3.3.0", + "@eslint/js": "^9.21.0", + "@storybook/addon-essentials": "^8.6.4", + "@storybook/addon-interactions": "^8.6.4", + "@storybook/addon-onboarding": "^8.6.4", + "@storybook/blocks": "^8.6.4", + "@storybook/react": "^8.6.4", + "@storybook/react-vite": "^8.6.4", + "@storybook/test": "^8.6.4", + "@tailwindcss/postcss": "^4.0.11", + "@types/node": "^22.13.10", "@types/react": "^18.0.9", "@types/react-dom": "^18.0.3", - "@types/styled-components": "^5.1.20", - "@typescript-eslint/eslint-plugin": "^5.9.1", - "@typescript-eslint/parser": "^5.9.1", - "babel-plugin-styled-components": "^2.0.2", - "eslint": "^7", - "eslint-config-prettier": "^8.3.0", + "@typescript-eslint/eslint-plugin": "^8.26.0", + "@typescript-eslint/parser": "^8.26.0", + "@vitejs/plugin-react": "^4.3.4", + "eslint": "^9.21.0", + "eslint-config-prettier": "^10.1.1", "eslint-import-resolver-parcel": "^1.10.6", - "eslint-plugin-import": "^2.25.3", - "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-react": "^7.27.1", - "eslint-plugin-react-hooks": "^4.3.0", - "eslint-plugin-security": "^1.4.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-prettier": "^5.2.3", + "eslint-plugin-react": "^7.37.4", + "eslint-plugin-react-hooks": "^5.2.0", + "eslint-plugin-security": "^3.0.1", + "eslint-plugin-storybook": "^0.11.4", + "globals": "^16.0.0", "husky": "^7.0.0", "lint-staged": "^12.1.2", - "parcel": "^2.2.1", - "prettier": "^2.5.1", + "prettier": "^3.5.3", + "prettier-plugin-tailwindcss": "^0.6.11", "process": "^0.11.10", - "styled-components": "^5.3.3", - "typescript": "^4.5.4" + "storybook": "^8.6.4", + "tailwindcss": "^4.0.11", + "typescript": "^5.8.2", + "vite": "^6.2.1", + "vite-plugin-svgr": "^4.3.0" }, "peerDependencies": { + "@tailwindcss/postcss": "^4.0.11", "react": "^18.0.0", "react-dom": "^18.0.0", "react-is": "^18.0.0", - "styled-components": "^5.3.3" + "tailwindcss": "^4.0.11" }, "dependencies": { - "@datepicker-react/hooks": "^2.8.4", - "@swc/helpers": "^0.3.2", - "rc-slider": "^9.7.5", + "@internationalized/date": "^3.7.0", + "@tailwindcss/vite": "^4.0.12", + "bignumber.js": "^9.1.2", + "clsx": "^2.1.1", "react": "^18.0.0", + "react-aria-components": "^1.7.1", "react-dom": "^18.0.0", "react-is": "^18.0.0", "simplebar": "^5.3.6", "simplebar-react": "^2.3.6", - "smooth-scroll-into-view-if-needed": "^1.1.33", - "usehooks-ts": "^2.9.1" + "tailwind-merge": "^3.0.2", + "tailwindcss-react-aria-components": "^2.0.0", + "usehooks-ts": "^2.9.1", + "vite-plugin-dts": "^4.5.3" }, "lint-staged": { "*.js": "eslint --cache --fix", "*.{js,css,md}": "prettier --write" }, "volta": { - "node": "16.20.1", - "yarn": "1.22.19" + "node": "20.18.3", + "yarn": "4.7.0" }, - "packageManager": "yarn@1.22.19+sha256.732620bac8b1690d507274f025f3c6cfdc3627a84d9642e38a07452cc00e0f2e" + "packageManager": "yarn@4.7.0", + "eslintConfig": { + "extends": [ + "plugin:storybook/recommended" + ] + } } diff --git a/src/App.tsx b/src/App.tsx deleted file mode 100644 index 3424c94..0000000 --- a/src/App.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import { createRoot } from "react-dom/client"; -import React, { useState } from "react"; -import styled, { ThemeProvider } from "styled-components"; -import { GlobalStyle } from "./styles/global-style"; -import { lightTheme, darkTheme } from "./styles/themes"; -import Button from "./lib/button"; -import Tabs from "./lib/pagination/tabs"; -import Card from "./lib/container/card"; -import Buttons from "./examples/buttons"; -import Pagination from "./examples/pagination"; -import Containers from "./examples/containers"; -import Accordion from "./examples/accordion"; -import Form from "./examples/form"; -import Dropdowns from "./examples/dropdowns"; -import Displays from "./examples/displays"; -import Messages from "./examples/messages"; -import Progress from "./examples/progress"; -import TimelineProgress from "./examples/timeline"; -import Input from "./examples/input"; -import Tooltips from "./examples/tooltip"; -import Copiable from "./examples/copiable"; - -const StyledDiv = styled.div` - position: fixed; - top: 0; - left: 0; - bottom: 0; - right: 0; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - flex-wrap: wrap; - padding: 36px 36px; - overflow: scroll; - background: ${(props) => props.theme.klerosUIComponentsLightBackground}; - transition: background ease - ${(props) => props.theme.klerosUIComponentsTransitionSpeed}; -`; - -const StyledCard = styled(Card)` - height: 500px; - width: 1000px; - display: flex; - justify-content: space-around; - align-items: center; - gap: 24px; - overflow: auto; - flex-wrap: wrap; - padding: 36px 36px; - background: ${(props) => props.theme.klerosUIComponentsLightBackground}; - transition: background ease - ${(props) => props.theme.klerosUIComponentsTransitionSpeed}; -`; - -const StyledTabs = styled(Tabs)` - width: 995px; -`; - -const StyledButton = styled(Button)` - margin-top: 64px; -`; - -const App = () => { - const [theme, setTheme] = useState(lightTheme); - const [example, setExample] = useState("buttons"); - return ( - - - - - - - {example === "buttons" && } - {example === "pagination" && } - {example === "containers" && } - {example === "accordion" && } - {example === "form" &&
} - {example === "dropdowns" && } - {example === "displays" && } - {example === "messages" && } - {example === "timeline" && } - {example === "progress" && } - {example === "input" && } - {example === "tooltip" && } - {example === "copiable" && } - - - theme === lightTheme ? setTheme(darkTheme) : setTheme(lightTheme) - } - /> - - - - ); -}; - -const app = document.getElementById("app"); -if (app) { - const root = createRoot(app); - root.render(); -} diff --git a/src/examples/accordion.tsx b/src/examples/accordion.tsx deleted file mode 100644 index 5525229..0000000 --- a/src/examples/accordion.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from "react"; -import styled from "styled-components"; -import Accordion from "../lib/accordion"; - -const StyledAccordion = styled(Accordion)` - width: 800px; -`; - -const StyledContent = styled.small` - color: ${({ theme }) => theme.klerosUIComponentsPrimaryText} !important; -`; - -const AccordionExample = () => ( - {"hello\nhello\n\n\n\n\nhello"}, - }, - { title: "How it works?", body: hello }, - ]} - /> -); - -export default AccordionExample; diff --git a/src/examples/buttons.tsx b/src/examples/buttons.tsx deleted file mode 100644 index 59071bc..0000000 --- a/src/examples/buttons.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from "react"; -import Button from "../lib/button"; -import Telegram from "../assets/svgs/telegram.svg"; - -const Buttons = () => ( - <> -