├── .babelrc.json ├── .eslintrc.json ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .husky └── pre-commit ├── .prettierignore ├── .prettierrc.js ├── .release-it.json ├── .storybook ├── main.js ├── preview.js └── storybook.css ├── .stylelintrc.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── package.json ├── postcss.config.js ├── src ├── components │ └── Component │ │ ├── Component.js │ │ ├── Component.module.css │ │ └── Component.stories.js ├── index.js └── style │ └── globals.css └── webpack.config.js /.babelrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "sourceType": "unambiguous", 3 | "presets": [ 4 | [ 5 | "@babel/preset-env", 6 | { 7 | "targets": { 8 | "chrome": 100, 9 | "safari": 15, 10 | "firefox": 91 11 | } 12 | } 13 | ], 14 | "@babel/preset-typescript", 15 | "@babel/preset-react" 16 | ], 17 | "plugins": [] 18 | } 19 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "env": { 4 | "node": true, 5 | "browser": true, 6 | "es2024": true 7 | }, 8 | "extends": [ 9 | "eslint:recommended", 10 | "plugin:css-modules/recommended", 11 | "plugin:react/recommended", 12 | "plugin:compat/recommended", 13 | "plugin:prettier/recommended", 14 | "prettier", 15 | "plugin:storybook/recommended" 16 | ], 17 | "plugins": ["compat", "prettier", "css-modules"], 18 | "parserOptions": { 19 | "ecmaFeatures": { 20 | "jsx": true 21 | }, 22 | "ecmaVersion": 12, 23 | "sourceType": "module" 24 | }, 25 | "settings": { 26 | "react": { 27 | "version": "detect" 28 | } 29 | }, 30 | "rules": { 31 | "jsx-a11y/alt-text": ["off"], 32 | "linebreak-style": [2, "unix"], 33 | "semi": [2, "always"], 34 | "no-multiple-empty-lines": [ 35 | 2, 36 | { 37 | "max": 1 38 | } 39 | ], 40 | "no-useless-catch": 0 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env*.local 29 | 30 | # vercel 31 | .vercel 32 | 33 | # typescript 34 | *.tsbuildinfo 35 | next-env.d.ts 36 | 37 | .idea 38 | package-lock.json 39 | 40 | # storybook static 41 | /storybook-static 42 | 43 | # dist 44 | /dist -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run stylelint || (false;) 5 | npm run lint || (false;) 6 | npm run format || (false;) 7 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .next 3 | .husky 4 | coverage 5 | .prettierignore 6 | .stylelintignore 7 | .eslintignore -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [], 3 | trailingComma: 'es5', 4 | tabWidth: 2, 5 | semi: true, 6 | singleQuote: true, 7 | }; 8 | -------------------------------------------------------------------------------- /.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "github": { 3 | "release": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.storybook/main.js: -------------------------------------------------------------------------------- 1 | import custom from '../webpack.config'; 2 | 3 | const path = require('path'); 4 | const config = { 5 | stories: ['../src/components/**/*.stories.@(js|jsx|ts|tsx)'], 6 | 7 | webpackFinal: async (config) => { 8 | return { 9 | ...config, 10 | module: { 11 | ...config.module, 12 | rules: [...config.module.rules, ...custom.module.rules], 13 | }, 14 | }; 15 | }, 16 | 17 | loader: { '.js': 'jsx' }, 18 | 19 | addons: [ 20 | '@storybook/addon-links', 21 | '@storybook/addon-essentials', 22 | '@storybook/addon-interactions', 23 | ], 24 | 25 | framework: { 26 | name: '@storybook/react-webpack5', 27 | options: {}, 28 | }, 29 | 30 | docs: { 31 | autodocs: true, 32 | }, 33 | }; 34 | export default config; 35 | -------------------------------------------------------------------------------- /.storybook/preview.js: -------------------------------------------------------------------------------- 1 | import '../src/style/globals.css'; 2 | import './storybook.css'; 3 | 4 | const preview = { 5 | parameters: { 6 | actions: { argTypesRegex: '^on[A-Z].*' }, 7 | controls: { 8 | matchers: { 9 | color: /(background|color)$/i, 10 | date: /Date$/, 11 | }, 12 | }, 13 | }, 14 | }; 15 | 16 | export default preview; 17 | -------------------------------------------------------------------------------- /.storybook/storybook.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: 6 | GalanoGrotesque, 7 | 'Noto Sans', 8 | -apple-system, 9 | BlinkMacSystemFont, 10 | 'Segoe UI', 11 | Roboto, 12 | Oxygen, 13 | Ubuntu, 14 | Cantarell, 15 | 'Fira Sans', 16 | 'Droid Sans', 17 | 'Helvetica Neue', 18 | sans-serif; 19 | -webkit-font-smoothing: antialiased; 20 | -moz-osx-font-smoothing: grayscale; 21 | background: white; 22 | } 23 | -------------------------------------------------------------------------------- /.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "stylelint-config-standard-scss", 4 | "stylelint-config-prettier-scss" 5 | ], 6 | "plugins": [ 7 | "stylelint-declaration-strict-value", 8 | "stylelint-no-unsupported-browser-features" 9 | ], 10 | "rules": { 11 | "selector-class-pattern": "^[a-z][a-zA-Z0-9]+$", 12 | "scss/no-global-function-names": null, 13 | "no-descending-specificity": null, 14 | "media-feature-range-notation": null, 15 | "scale-unlimited/declaration-strict-value": [ 16 | ["/color$/"], 17 | { 18 | "disableFix": true 19 | } 20 | ], 21 | "declaration-block-no-redundant-longhand-properties": [ 22 | true, 23 | { 24 | "ignoreShorthands": ["/flex/"] 25 | } 26 | ], 27 | "plugin/no-unsupported-browser-features": [ 28 | true, 29 | { 30 | "browsers": [">1%", "not dead", "not op_mini all"], 31 | "ignorePartialSupport": true, 32 | "ignore": [ 33 | "css-nesting", 34 | "css-resize", 35 | "css-focus-visible", 36 | "css3-cursors" 37 | ] 38 | } 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | . 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # CONTRIBUTING 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023 START-BASE 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tsup-template 2 | 3 | The tsup-template is a project or template designed to facilitate the creation of React components by providing certain features. Here's an explanation of its key features: 4 | 5 | ## Features 6 | 7 | - Features of tsup-template: 8 | 9 | Create React components with ease: This template is intended to simplify the process of building React components. It likely includes a boilerplate setup, file structure, and configuration that makes it easy to get started with creating new components without having to set up everything from scratch. 10 | 11 | - Css bundling ready: 12 | 13 | It appears that the template is configured to handle CSS bundling. This is important for styling your React components. CSS bundling typically involves bundling and optimizing CSS files, making sure they are efficiently loaded in the application. 14 | 15 | - Linter Formatter installed and configured: 16 | 17 | This template seems to come with a linter and code formatter already installed and set up. This is beneficial for maintaining a consistent and clean codebase. Linters help catch code issues, and formatters automatically format the code according to a predefined style guide. 18 | 19 | - Storybook installed and configured: 20 | 21 | Additionally, this template includes Storybook, a powerful tool for developing and testing UI components in isolation. With Storybook set up and configured, you can create and showcase your React component stories, making it easier to test and demonstrate your components' various states and use cases. 22 | 23 | In summary, the tsup-template is an all-in-one solution for React component development. It provides an easy and efficient way to create components, handles CSS bundling, ensures code quality with linters and formatters, and offers the benefits of Storybook for UI component development and testing. This template simplifies the development process, saving developers time and effort. 24 | 25 | # package-name 26 | 27 | Shield.io badges here. 28 | 29 | ## Table of Contents 30 | 31 | - [Installation](#installation) 32 | - [Documentation](#documentation) 33 | - [Components](#components) 34 | - [Examples](#examples) 35 | - [Demos](#demos) 36 | 37 | ## Installation 38 | 39 | To install, you can use [npm](https://npmjs.org/) or [yarn](https://yarnpkg.com): 40 | 41 | $ npm install --save package-name 42 | $ yarn add package-name 43 | 44 | ## Documentation 45 | 46 | Make sure to add css file to your app root file 47 | 48 | ```jsx 49 | import 'package-name/dist/lib/index.css'; 50 | ``` 51 | 52 | ## Components 53 | 54 | ## Props 55 | 56 | | Name | Type | Default | Description | 57 | | ---- | ---- | ------- | ----------- | 58 | 59 | ## Examples 60 | 61 | Here's an example of using the component in a React component: 62 | 63 | ```jsx 64 | import React, { useState } from 'react'; 65 | 66 | import { Component } from 'package-name'; 67 | 68 | export default function Page() { 69 | return ; 70 | } 71 | ``` 72 | 73 | ## Demos 74 | 75 | For live demos of these components in action, please visit our [Storybook]() demo pages. 76 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 1.x.x | :white_check_mark: | 11 | | < 1.0 | :x: | 12 | 13 | ## Reporting a Vulnerability 14 | 15 | Use this section to tell people how to report a vulnerability. 16 | 17 | Tell them where to go, how often they can expect to get an update on a 18 | reported vulnerability, what to expect if the vulnerability is accepted or 19 | declined, etc. 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "package-name", 3 | "author": "AUTHOR", 4 | "description": "DESCRIPTION", 5 | "version": "1.0.0", 6 | "license": "MIT", 7 | "repository": { 8 | "type": "git", 9 | "url": "git+REPO_URL.git" 10 | }, 11 | "bugs": { 12 | "url": "URL" 13 | }, 14 | "homepage": "HOMEPAGE", 15 | "files": [ 16 | "dist" 17 | ], 18 | "keywords": [ 19 | "react", 20 | "react-component", 21 | "ui" 22 | ], 23 | "main": "dist/lib/index.cjs", 24 | "module": "dist/lib/index.js", 25 | "scripts": { 26 | "lint": "eslint src/**/*.js --fix", 27 | "format": "prettier --write .", 28 | "stylelint": "stylelint \"src/**/*.css\" --fix", 29 | "unimported": "npx unimported", 30 | "release": "release-it", 31 | "storybook": "storybook dev -p 6006", 32 | "build-storybook": "storybook build", 33 | "build:lib": "rm -rf dist/lib && tsup src/index.js --out-dir dist/lib", 34 | "publish": "npm publish --access public" 35 | }, 36 | "peerDependencies": { 37 | "prop-types": "^15.0.0", 38 | "react": "^18.0.0", 39 | "react-dom": "^18.0.0" 40 | }, 41 | "dependencies": { 42 | "prop-types": "^15.0.0", 43 | "react": "^18.0.0", 44 | "react-dom": "^18.0.0" 45 | }, 46 | "devDependencies": { 47 | "@babel/core": "7.23.2", 48 | "@babel/preset-env": "7.23.2", 49 | "@babel/preset-react": "7.22.15", 50 | "@storybook/addon-essentials": "7.5.1", 51 | "@storybook/addon-interactions": "7.5.1", 52 | "@storybook/addon-links": "7.5.1", 53 | "@storybook/addon-onboarding": "1.0.8", 54 | "@storybook/blocks": "7.5.1", 55 | "@storybook/react": "7.5.1", 56 | "@storybook/react-webpack5": "7.5.1", 57 | "@storybook/testing-library": "0.2.2", 58 | "autoprefixer": "10.4.16", 59 | "babel-loader": "9.1.3", 60 | "css-loader": "6.8.1", 61 | "eslint": "8.52.0", 62 | "eslint-config-prettier": "9.0.0", 63 | "eslint-plugin-compat": "4.2.0", 64 | "eslint-plugin-css-modules": "2.12.0", 65 | "eslint-plugin-prettier": "5.0.1", 66 | "eslint-plugin-react": "^7.33.2", 67 | "eslint-plugin-storybook": "0.6.15", 68 | "husky": "8.0.3", 69 | "mini-css-extract-plugin": "2.7.6", 70 | "node-sass": "9.0.0", 71 | "postcss": "8.4.31", 72 | "postcss-prefixer": "3.0.0", 73 | "prettier": "3.0.3", 74 | "release-it": "16.2.1", 75 | "sass": "1.69.4", 76 | "sass-loader": "13.3.2", 77 | "storybook": "7.5.1", 78 | "style-loader": "3.3.3", 79 | "stylelint": "15.11.0", 80 | "stylelint-config-prettier-scss": "1.0.0", 81 | "stylelint-config-standard-scss": "11.0.0", 82 | "stylelint-declaration-strict-value": "1.9.2", 83 | "stylelint-no-unsupported-browser-features": "7.0.0", 84 | "stylelint-scss": "5.2.1", 85 | "tsup": "7.2.0", 86 | "webpack": "5.89.0", 87 | "webpack-bundle-analyzer": "4.9.1", 88 | "webpack-cli": "5.1.4" 89 | }, 90 | "tsup": { 91 | "format": [ 92 | "esm", 93 | "cjs" 94 | ], 95 | "loader": { 96 | ".css": "local-css", 97 | ".js": "jsx" 98 | }, 99 | "dts": false, 100 | "sourcemap": false, 101 | "clean": true 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [require('autoprefixer')()], 3 | }; 4 | -------------------------------------------------------------------------------- /src/components/Component/Component.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import s from './Component.module.css'; 4 | 5 | const Component = () => { 6 | return
; 7 | }; 8 | 9 | export default Component; 10 | -------------------------------------------------------------------------------- /src/components/Component/Component.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | background: black; 3 | width: 100px; 4 | height: 100px; 5 | } 6 | -------------------------------------------------------------------------------- /src/components/Component/Component.stories.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import ReactComponent from './Component.js'; 4 | 5 | const Template = () => { 6 | return ( 7 | <> 8 |

Component

9 | 10 | 11 | ); 12 | }; 13 | 14 | export const StoryComponent = Template.bind({}); 15 | 16 | const Component = { 17 | title: 'Component', 18 | component: ReactComponent, 19 | }; 20 | 21 | export default Component; 22 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import Component from './components/Component/Component'; 2 | 3 | export { Component }; 4 | -------------------------------------------------------------------------------- /src/style/globals.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --rfe-white: #fff; 3 | --rfe-white-rgb: 255 255 255; 4 | --rfe-black: #000; 5 | --rfe-black-rgb: 0 0 0; 6 | } 7 | 8 | @media (prefers-color-scheme: dark) { 9 | :root { 10 | --white: #000; 11 | --white-rgb: 0 0 0; 12 | --black: #fff; 13 | --black-rgb: 255 255 255; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | entry: './src/index.js', 3 | plugins: [], 4 | module: { 5 | rules: [ 6 | { 7 | test: /\.js$/, 8 | exclude: /node_modules/, 9 | use: { 10 | loader: 'babel-loader', 11 | options: { 12 | presets: [ 13 | ['@babel/preset-env', { targets: 'defaults' }], 14 | ['@babel/preset-react', { runtime: 'automatic' }], 15 | ], 16 | }, 17 | }, 18 | }, 19 | ], 20 | }, 21 | }; 22 | --------------------------------------------------------------------------------