From a94c9517198525d3791f570c55e6f87c9fe0d823 Mon Sep 17 00:00:00 2001 From: hemengke <23536175@qq.com> Date: Sun, 25 Aug 2024 11:35:39 +0800 Subject: [PATCH 1/8] feat: refactor css modules to global BEM class --- README.md | 19 +++-- example/src/main.tsx | 1 + example/src/page/api/api.tsx | 2 +- example/src/page/example/example.tsx | 10 ++- .../page/getting-started/getting-started.tsx | 1 + example/src/page/theme/theme.tsx | 6 ++ package.json | 29 +++++-- postcss.config.js | 17 ---- rollup.config.mjs | 9 --- src/component/toast-message.tsx | 36 ++++----- src/index.tsx | 7 +- src/style.css | 64 --------------- src/style.scss | 80 +++++++++++++++++++ src/theme/blue-dusk.css | 2 +- src/theme/chroma.css | 11 ++- src/theme/dark-edge.css | 2 +- src/theme/dark.css | 2 +- src/theme/failure.css | 2 +- src/theme/frosted-glass.css | 4 +- src/theme/info.css | 2 +- src/theme/light-edge.css | 2 +- src/theme/light.css | 2 +- src/theme/moonlight.css | 2 +- src/theme/ocean-wave.css | 2 +- src/theme/pink-dawn.css | 2 +- src/theme/plain.css | 2 +- src/theme/success.css | 2 +- src/theme/sunset.css | 2 +- src/theme/theme-classnames.json | 1 - src/theme/warning.css | 2 +- src/type.d.ts | 1 - src/type/common.ts | 1 + yarn.lock | 34 ++++++++ 33 files changed, 211 insertions(+), 150 deletions(-) delete mode 100644 src/style.css create mode 100644 src/style.scss delete mode 100644 src/theme/theme-classnames.json delete mode 100644 src/type.d.ts diff --git a/README.md b/README.md index b04ee84..79d8540 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Elevate your React applications with ultra-sleek toast notifications! With React
## Table of Contents + - [Installation](#Installation) - [Usage](#Usage) - [Key Features](#Key-Features) @@ -24,37 +25,35 @@ Elevate your React applications with ultra-sleek toast notifications! With React - [License](#License) + ## Installation 📦 Get started in seconds! - - ```bash npm install react-simple-toasts ``` + ## Usage 💡 Integrate with ease. Customize with flair. ```jsx import toast, { toastConfig } from 'react-simple-toasts'; +import 'react-simple-toasts/dist/style.css'; import 'react-simple-toasts/dist/theme/dark.css'; toastConfig({ theme: 'dark' }); function MyComponent() { - return ( - - ); + return ; } ``` + ## Key Features 🌟 - **Ease of Use**: Set up in minutes, not hours! @@ -64,31 +63,37 @@ function MyComponent() { - **Multi-Toast Control**: Manage multiple notifications effortlessly. + ## Themes 🎨 Your style, your toast. Choose from built-in themes or create your own. ### Standard Theme +### Creative Theme +
+ ## Documentation 📘 Explore full [documentation](https://almond-bongbong.github.io/react-simple-toasts/) for in-depth guides, examples, and API details. + ## Contribute 🤝 Join our growing community! [Star us on GitHub](https://github.com/almond-bongbong/react-simple-toasts/stargazers) and contribute to making React Simple Toasts better. + ## License 📜 React Simple Toasts is MIT licensed. diff --git a/example/src/main.tsx b/example/src/main.tsx index 9342142..74128c4 100644 --- a/example/src/main.tsx +++ b/example/src/main.tsx @@ -3,6 +3,7 @@ import ReactDOM from 'react-dom/client'; import App from './app'; import './index.css'; import { toastConfig } from 'react-simple-toasts'; +import 'react-simple-toasts/dist/style.css'; import.meta.globEager('/node_modules/react-simple-toasts/dist/theme/*.css'); diff --git a/example/src/page/api/api.tsx b/example/src/page/api/api.tsx index 80670da..ca8dc6f 100644 --- a/example/src/page/api/api.tsx +++ b/example/src/page/api/api.tsx @@ -18,7 +18,7 @@ function Api() {
You can directly specify a theme when calling the toast function.
You can directly specify a theme when calling the toast function.