├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
├── _redirects
├── favicon.ico
└── index.html
└── src
├── App.js
├── assets
├── img
│ ├── ada.jpg
│ ├── bnb.jpg
│ ├── colors.svg
│ ├── doge.jpg
│ ├── eth.jpg
│ ├── shib.jpg
│ ├── usdc.jpg
│ └── usdt.jpg
└── styles
│ ├── components
│ ├── _borderRadius.scss
│ ├── _boxshadow.scss
│ ├── _colorGenerator.scss
│ ├── _imageFilter.scss
│ └── _markdowm.scss
│ ├── global
│ ├── _common.scss
│ ├── _fonts.scss
│ ├── _reset.scss
│ └── _scrollbar.scss
│ └── index.scss
├── components
├── BorderRadius.js
├── ColorGenerator
│ ├── SingleColor.js
│ └── index.js
├── ColorPicker.js
├── Gradient.js
├── ImageFilter.js
├── MarkdownGenerator
│ ├── Html.js
│ ├── Text.js
│ └── index.js
├── ShadowGenerator.js
├── Skew.js
├── TextEditor.js
├── TextShadowGenerator.js
├── donation
│ ├── DonateCard.js
│ └── index.js
└── layout
│ ├── Footer.js
│ ├── Header.js
│ └── index.js
├── constants
├── menuItems.js
└── walletCards.js
├── hooks
└── useTitle.js
├── index.js
├── routes
└── index.js
└── utils
├── ScrollTotop.js
├── colorFormat.js
├── copyToClipboard.js
├── theme.js
└── toast.js
/.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 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 |
9 | ### `npm start`
10 |
11 | Runs the app in the development mode.\
12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13 |
14 | The page will reload when you make changes.\
15 | You may also see any lint errors in the console.
16 |
17 | ### `npm test`
18 |
19 | Launches the test runner in the interactive watch mode.\
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 |
22 | ### `npm run build`
23 |
24 | Builds the app for production to the `build` folder.\
25 | It correctly bundles React in production mode and optimizes the build for the best performance.
26 |
27 | The build is minified and the filenames include the hashes.\
28 | Your app is ready to be deployed!
29 |
30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 |
32 | ### `npm run eject`
33 |
34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35 |
36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 |
38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39 |
40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41 |
42 | ## Learn More
43 |
44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 |
46 | To learn React, check out the [React documentation](https://reactjs.org/).
47 |
48 | ### Code Splitting
49 |
50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 |
52 | ### Analyzing the Bundle Size
53 |
54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 |
56 | ### Making a Progressive Web App
57 |
58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 |
60 | ### Advanced Configuration
61 |
62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 |
64 | ### Deployment
65 |
66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 |
68 | ### `npm run build` fails to minify
69 |
70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
71 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "magic-css",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@emotion/react": "^11.10.0",
7 | "@emotion/styled": "^11.10.0",
8 | "@mui/icons-material": "^5.8.4",
9 | "@mui/material": "^5.9.3",
10 | "@testing-library/jest-dom": "^5.16.5",
11 | "@testing-library/react": "^13.3.0",
12 | "@testing-library/user-event": "^13.5.0",
13 | "react": "^18.2.0",
14 | "react-awesome-button": "^6.5.1",
15 | "react-color": "^2.19.3",
16 | "react-dom": "^18.2.0",
17 | "react-icons": "^4.7.1",
18 | "react-markdown": "^8.0.4",
19 | "react-router-dom": "^6.3.0",
20 | "react-scripts": "5.0.1",
21 | "react-toastify": "^9.0.7",
22 | "sass": "^1.54.3",
23 | "uuid": "^9.0.0",
24 | "values.js": "^2.1.1",
25 | "web-vitals": "^2.1.4"
26 | },
27 | "scripts": {
28 | "start": "react-scripts start",
29 | "build": "react-scripts build",
30 | "test": "react-scripts test",
31 | "eject": "react-scripts eject"
32 | },
33 | "eslintConfig": {
34 | "extends": [
35 | "react-app",
36 | "react-app/jest"
37 | ]
38 | },
39 | "browserslist": {
40 | "production": [
41 | ">0.2%",
42 | "not dead",
43 | "not op_mini all"
44 | ],
45 | "development": [
46 | "last 1 chrome version",
47 | "last 1 firefox version",
48 | "last 1 safari version"
49 | ]
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/public/_redirects:
--------------------------------------------------------------------------------
1 | /* /index.html 200
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parham-ab/React-magic-css/7e95c56ec2b038e9a789d9a5a7c465ef91caf876/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 |
12 | Magic CSS
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import { Route, Routes, Navigate } from "react-router-dom";
2 | import LayOut from "./components/layout";
3 | import ScrollToTop from "./utils/ScrollTotop";
4 | import { ThemeProvider } from "@mui/material/styles";
5 | import { theme } from "./utils/theme";
6 | import { routes } from "./routes";
7 | import { ToastContainer } from "react-toastify";
8 | import "react-toastify/dist/ReactToastify.css";
9 |
10 | const App = () => {
11 | return (
12 |
13 |
14 |
15 | {routes.map((item) => (
16 | }
20 | />
21 | ))}
22 | } />
23 |
24 |
25 |
26 |
27 |
28 | );
29 | };
30 | export default App;
31 |
--------------------------------------------------------------------------------
/src/assets/img/ada.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parham-ab/React-magic-css/7e95c56ec2b038e9a789d9a5a7c465ef91caf876/src/assets/img/ada.jpg
--------------------------------------------------------------------------------
/src/assets/img/bnb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parham-ab/React-magic-css/7e95c56ec2b038e9a789d9a5a7c465ef91caf876/src/assets/img/bnb.jpg
--------------------------------------------------------------------------------
/src/assets/img/colors.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/assets/img/doge.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parham-ab/React-magic-css/7e95c56ec2b038e9a789d9a5a7c465ef91caf876/src/assets/img/doge.jpg
--------------------------------------------------------------------------------
/src/assets/img/eth.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parham-ab/React-magic-css/7e95c56ec2b038e9a789d9a5a7c465ef91caf876/src/assets/img/eth.jpg
--------------------------------------------------------------------------------
/src/assets/img/shib.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parham-ab/React-magic-css/7e95c56ec2b038e9a789d9a5a7c465ef91caf876/src/assets/img/shib.jpg
--------------------------------------------------------------------------------
/src/assets/img/usdc.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parham-ab/React-magic-css/7e95c56ec2b038e9a789d9a5a7c465ef91caf876/src/assets/img/usdc.jpg
--------------------------------------------------------------------------------
/src/assets/img/usdt.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/parham-ab/React-magic-css/7e95c56ec2b038e9a789d9a5a7c465ef91caf876/src/assets/img/usdt.jpg
--------------------------------------------------------------------------------
/src/assets/styles/components/_borderRadius.scss:
--------------------------------------------------------------------------------
1 | .radiusbox {
2 | width: 200px;
3 | height: 200px;
4 | background-color: rgb(168, 168, 168);
5 | }
6 |
--------------------------------------------------------------------------------
/src/assets/styles/components/_boxshadow.scss:
--------------------------------------------------------------------------------
1 | // styles
2 | .boxshadow-container {
3 | display: flex !important;
4 | flex-direction: column !important;
5 | .boxshadow-item {
6 | display: flex !important;
7 | justify-content: center !important;
8 | margin: 3rem 0 10rem !important;
9 | }
10 | }
--------------------------------------------------------------------------------
/src/assets/styles/components/_colorGenerator.scss:
--------------------------------------------------------------------------------
1 | .colorListImg {
2 | display: flex;
3 | margin: auto;
4 | width: 700px;
5 | }
--------------------------------------------------------------------------------
/src/assets/styles/components/_imageFilter.scss:
--------------------------------------------------------------------------------
1 | // media-queries for custom box
2 | $Xsmall: 588px;
3 | $small: 530px;
4 | $medium: 760px;
5 | @media screen and (max-width: $medium) {
6 | .filterimage-container {
7 | flex-direction: column !important;
8 | align-items: center !important;
9 | }
10 | }
11 | @media screen and (max-width: $small) {
12 | .filter-img {
13 | width: 80% !important;
14 | margin: 0 30px !important;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/assets/styles/components/_markdowm.scss:
--------------------------------------------------------------------------------
1 | .markdown-input {
2 | max-width: 400px;
3 | height: 400px;
4 | padding: 0.4rem;
5 | font-size: 1.2rem;
6 | border-radius: 12px;
7 | box-shadow: rgba(0, 0, 0, 0.25) 0px 25px 50px -12px;
8 | border: solid #dddddd 1px;
9 | resize: vertical;
10 | }
--------------------------------------------------------------------------------
/src/assets/styles/global/_common.scss:
--------------------------------------------------------------------------------
1 | .active {
2 | background-color: #a1cbed !important;
3 | }
4 | .custom-box {
5 | width: 60rem;
6 | height: 15rem;
7 | border-radius: 10px;
8 | box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
9 | margin: 0 auto;
10 | }
11 | // media-queries for custom box
12 | $Xsmall: 588px;
13 | $small: 588px;
14 | $medium: 930px;
15 | $big: 1078px;
16 | @media screen and (max-width: $big) {
17 | .custom-box {
18 | width: 50rem !important;
19 | }
20 | }
21 | @media screen and (max-width: $medium) {
22 | .custom-box {
23 | width: 30rem !important;
24 | }
25 | }
26 | @media screen and (max-width: $small) {
27 | .custom-box {
28 | width: 20rem !important;
29 | }
30 | }
31 | @media screen and (max-width: $Xsmall) {
32 | .custom-box {
33 | width: 14rem !important;
34 | }
35 | }
--------------------------------------------------------------------------------
/src/assets/styles/global/_fonts.scss:
--------------------------------------------------------------------------------
1 | // fonts
2 | @import url("https://fonts.googleapis.com/css2?family=Quicksand&family=Rubik:ital,wght@0,300;1,300&display=swap");
--------------------------------------------------------------------------------
/src/assets/styles/global/_reset.scss:
--------------------------------------------------------------------------------
1 | // CSS Reset
2 | *,
3 | *::before,
4 | *::after {
5 | margin: 0;
6 | padding: 0;
7 | box-shadow: none;
8 | text-decoration: none;
9 | outline: none;
10 | }
11 | a {
12 | color: inherit;
13 | }
14 | body {
15 | font-family: "Quicksand", sans-serif;
16 | font-family: "Rubik", sans-serif;
17 | }
--------------------------------------------------------------------------------
/src/assets/styles/global/_scrollbar.scss:
--------------------------------------------------------------------------------
1 | // scroll bar
2 | ::-webkit-scrollbar {
3 | width: 6px;
4 | height: 6px;
5 | }
6 | ::-webkit-scrollbar-track {
7 | background-color: transparent;
8 | }
9 | ::-webkit-scrollbar-thumb {
10 | background-color: #1c2442;
11 | border-radius: 5px;
12 | }
13 | ::-webkit-scrollbar-thumb:hover {
14 | background-color: #334172;
15 | }
16 | ::-webkit-scrollbar-thumb:active {
17 | background-color: #192759;
18 | }
--------------------------------------------------------------------------------
/src/assets/styles/index.scss:
--------------------------------------------------------------------------------
1 | @import "components/boxshadow";
2 | @import "components/borderRadius";
3 | @import "components/colorGenerator";
4 | @import "components/imageFilter";
5 | @import "components/markdowm";
6 | @import "global/fonts";
7 | @import "global/reset";
8 | @import "global/scrollbar";
9 | @import "global/common";
--------------------------------------------------------------------------------
/src/components/BorderRadius.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import {
3 | Box,
4 | Button,
5 | FormControl,
6 | FormControlLabel,
7 | FormLabel,
8 | Grid,
9 | InputLabel,
10 | MenuItem,
11 | Radio,
12 | RadioGroup,
13 | Select,
14 | Slider,
15 | Typography,
16 | } from "@mui/material";
17 | import { Container } from "@mui/system";
18 | import AssignmentIcon from "@mui/icons-material/Assignment";
19 | import UseTitle from "../hooks/useTitle";
20 | import { copyToClipboard } from './../utils/copyToClipboard';
21 |
22 | const BorderRadius = () => {
23 | const [type, setType] = useState("Same on all sides");
24 | const [allRadius, setAllRadius] = useState(0);
25 | const [unit, setUnit] = useState("px");
26 | const [topLeft, setTopLeft] = useState(0);
27 | const [topRight, setTopRight] = useState(0);
28 | const [bottomRight, setBottomRight] = useState(0);
29 | const [bottomLeft, setBottomLeft] = useState(0);
30 | const [finalSource, setFinalSource] = useState("");
31 |
32 | useEffect(() => {
33 | // -----Same on all sides-----
34 | if (type === "Same on all sides" && unit === "%") {
35 | setFinalSource(`border-radius:${allRadius}%`);
36 | } else if (type === "Same on all sides" && unit === "px") {
37 | setFinalSource(`border-radius:${allRadius}px`);
38 | }
39 | // -----Different on all Sides-----
40 | if (type === "Different on all Sides" && unit === "px") {
41 | setFinalSource(
42 | `border-radius:${topLeft}px ${topRight}px ${bottomRight}px ${bottomLeft}px`
43 | );
44 | } else if (type === "Different on all Sides" && unit === "%") {
45 | setFinalSource(
46 | `border-radius:${topLeft}% ${topRight}% ${bottomRight}% ${bottomLeft}%`
47 | );
48 | }
49 | }, [type, allRadius, unit, topLeft, topRight, bottomRight, bottomLeft]);
50 | UseTitle("Magic CSS - Border radius");
51 |
52 | return (
53 |
54 |
60 |
61 |
62 | Type
63 |
75 |
76 | {/* same on all sides */}
77 | {type === "Same on all sides" ? (
78 | <>
79 |
85 | Radius
86 |
87 | setAllRadius(e.target.value)}
97 | />
98 |
99 |
100 |
101 | Unit
102 |
103 | setUnit(e.target.value)}
107 | >
108 | }
111 | label="PX"
112 | />
113 | }
116 | label="%"
117 | />
118 |
119 |
120 | >
121 | ) : (
122 | <>
123 |
129 | Top-left
130 |
131 | setTopLeft(e.target.value)}
141 | />
142 |
148 | Top-right
149 |
150 | setTopRight(e.target.value)}
160 | />
161 |
167 | Bottom-right
168 |
169 | setBottomRight(e.target.value)}
179 | />
180 |
186 | Bottom-left
187 |
188 | setBottomLeft(e.target.value)}
198 | />
199 |
200 |
201 |
202 | Unit
203 |
204 | setUnit(e.target.value)}
208 | >
209 | }
212 | label="PX"
213 | />
214 | }
217 | label="%"
218 | />
219 |
220 |
221 | >
222 | )}
223 |
224 | {/* results */}
225 |
226 |
242 |
250 |
251 |
252 |
253 | );
254 | };
255 |
256 | export default BorderRadius;
257 |
--------------------------------------------------------------------------------
/src/components/ColorGenerator/SingleColor.js:
--------------------------------------------------------------------------------
1 | import { Box } from "@mui/system";
2 | import rgbToHex from "../../utils/colorFormat";
3 | import { Typography } from "@mui/material";
4 | import { copyToClipboard } from "./../../utils/copyToClipboard";
5 |
6 | const SingleColor = ({ rgb }) => {
7 | const hex = rgbToHex(...rgb);
8 | return (
9 |
18 | copyToClipboard(`background-color: rgb(${rgb.join(", ")})`)
19 | }
20 | display="flex"
21 | alignItems="center"
22 | justifyContent="center"
23 | >
24 |
34 | {hex}
35 |
36 |
37 | );
38 | };
39 | export default SingleColor;
40 |
--------------------------------------------------------------------------------
/src/components/ColorGenerator/index.js:
--------------------------------------------------------------------------------
1 | import { v4 as uuidv4 } from "uuid";
2 | import Values from "values.js";
3 | import SearchIcon from "@mui/icons-material/Search";
4 | import colorListImg from "../../assets/img/colors.svg";
5 | import UseTitle from "../../hooks/useTitle";
6 | import { Container } from "@mui/system";
7 | import { Box, Grid, TextField } from "@mui/material";
8 | import { useState } from "react";
9 | import SingleColor from "./SingleColor";
10 | import { notify } from "../../utils/toast";
11 |
12 | const ColorGenerator = () => {
13 | const [color, setColor] = useState("");
14 | const [error, setError] = useState(false);
15 | const [list, setList] = useState([]);
16 | const handleSubmit = (e) => {
17 | e.preventDefault();
18 | try {
19 | let colors = new Values(color).all(10);
20 | setError(false);
21 | setList(colors);
22 | } catch (error) {
23 | setError(true);
24 | notify("error", "Please enter a valid color!");
25 | }
26 | };
27 | UseTitle("Magic CSS - Color Generator");
28 |
29 | return (
30 |
31 |
32 |
33 | setColor(e.target.value)}
42 | InputProps={{
43 | endAdornment: (
44 |
49 | ),
50 | }}
51 | />
52 |
53 | {list.length ? (
54 | list.map((item) => )
55 | ) : (
56 |
57 | )}
58 |
59 |
60 |
61 |
62 | );
63 | };
64 |
65 | export default ColorGenerator;
66 |
--------------------------------------------------------------------------------
/src/components/ColorPicker.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from "react";
2 | import { Button, Grid } from "@mui/material";
3 | import { SketchPicker } from "react-color";
4 | import UseTitle from "../hooks/useTitle";
5 | import AssignmentIcon from "@mui/icons-material/Assignment";
6 | import { Container } from "@mui/system";
7 | import { copyToClipboard } from './../utils/copyToClipboard';
8 |
9 | const ColorPicker = () => {
10 | const [firstColor, setFirstColor] = useState("");
11 | const [finalSource, setFinalSource] = useState();
12 | const changeHandle = (e) => {
13 | setFirstColor(e.hex);
14 | };
15 | useEffect(() => {
16 | setFinalSource(firstColor);
17 | }, [firstColor]);
18 | UseTitle("Magic CSS - Color Picker");
19 |
20 | return (
21 |
22 |
23 |
24 |
25 |
33 |
34 |
35 |
36 | );
37 | };
38 |
39 | export default ColorPicker;
40 |
--------------------------------------------------------------------------------
/src/components/Gradient.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import {
3 | Button,
4 | Container,
5 | FormControl,
6 | FormControlLabel,
7 | FormLabel,
8 | Grid,
9 | Radio,
10 | RadioGroup,
11 | Slider,
12 | Typography,
13 | } from "@mui/material";
14 | import { Box } from "@mui/system";
15 | import AssignmentIcon from "@mui/icons-material/Assignment";
16 | import { SketchPicker } from "react-color";
17 | import UseTitle from "../hooks/useTitle";
18 | import { copyToClipboard } from './../utils/copyToClipboard';
19 |
20 | const Gradient = () => {
21 | const [firstColor, setFirstColor] = useState("");
22 | const [secondColor, setSecondColor] = useState("");
23 | const [angle, setAngle] = useState(0);
24 | const [gradientType, setGradientType] = useState("Linear");
25 | const [finalSource, setFinalSource] = useState();
26 | useEffect(() => {
27 | gradientType === "Linear"
28 | ? setFinalSource(
29 | `background:linear-gradient(${angle}deg,${firstColor},${secondColor})`
30 | )
31 | : setFinalSource(
32 | `background:radial-gradient(circle,${firstColor},${secondColor})`
33 | );
34 | }, [firstColor, secondColor, angle, gradientType]);
35 | UseTitle("Magic CSS - gradient");
36 |
37 | return (
38 |
39 |
40 |
41 |
52 |
53 |
54 |
63 |
64 |
65 | Type
66 |
67 | setGradientType(e.target.value)}
71 | >
72 | }
75 | label="Linear"
76 | />
77 | }
80 | label="Radial"
81 | />
82 |
83 |
84 | {gradientType === "Linear" && (
85 |
86 |
91 | Angle
92 |
93 | setAngle(e.target.value)}
103 | />
104 |
105 | )}
106 |
114 |
115 |
116 |
117 |
118 | setFirstColor(e.hex)}
123 | />
124 |
125 |
126 | setSecondColor(e.hex)}
131 | />
132 |
133 |
134 |
135 |
136 |
137 |
138 | );
139 | };
140 |
141 | export default Gradient;
142 |
--------------------------------------------------------------------------------
/src/components/ImageFilter.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import {
3 | Box,
4 | Button,
5 | Container,
6 | Grid,
7 | IconButton,
8 | Slider,
9 | Typography,
10 | } from "@mui/material";
11 | import PhotoCamera from "@mui/icons-material/PhotoCamera";
12 | import AssignmentIcon from "@mui/icons-material/Assignment";
13 | import RestartAltIcon from "@mui/icons-material/RestartAlt";
14 | import UseTitle from "../hooks/useTitle";
15 | import { copyToClipboard } from './../utils/copyToClipboard';
16 |
17 | const ImageFilter = () => {
18 | const [greyscaleVal, setGreyscaleVal] = useState(0);
19 | const [blurVal, setBlurVal] = useState(0);
20 | const [sepiaVal, setSepiaVal] = useState(0);
21 | const [saturateVal, setSaturateVal] = useState(1);
22 | const [opacityVal, setOpacityVal] = useState(1);
23 | const [brightnessVal, setBrightnessVal] = useState(100);
24 | const [contrastVal, setContrastVal] = useState(100);
25 | const [hueVal, setHueVal] = useState(0);
26 | const [invertVal, setInvertVal] = useState(0);
27 | const [img, setImg] = useState();
28 | const [finalSource, setFinalSource] = useState("");
29 |
30 | useEffect(() => {
31 | setFinalSource(
32 | `filter: grayscale(${greyscaleVal}%) blur(${blurVal}px) sepia(${sepiaVal}) saturate(${saturateVal}) opacity(${opacityVal}) brightness(${brightnessVal}%) contrast(${contrastVal}%) hue-rotate(${hueVal}deg) invert(${invertVal}%)`
33 | );
34 | }, [
35 | greyscaleVal,
36 | blurVal,
37 | sepiaVal,
38 | saturateVal,
39 | opacityVal,
40 | brightnessVal,
41 | contrastVal,
42 | hueVal,
43 | invertVal,
44 | ]);
45 | // upload image
46 | function onImageChange(e) {
47 | setImg(URL.createObjectURL(e.target.files[0]));
48 | }
49 | const resetBtn = () => {
50 | setGreyscaleVal(0);
51 | setBlurVal(0);
52 | setSepiaVal(0);
53 | setSaturateVal(1);
54 | setOpacityVal(1);
55 | setBrightnessVal(100);
56 | setContrastVal(100);
57 | setHueVal(0);
58 | setInvertVal(0);
59 | };
60 | UseTitle("Magic CSS - Image filter");
61 | return (
62 |
63 |
69 |
70 |
71 | Grayscale
72 |
73 | setGreyscaleVal(e.target.value)}
83 | />
84 |
85 |
86 | Blur
87 |
88 | setBlurVal(e.target.value)}
98 | />
99 |
100 |
101 | Sepia
102 |
103 | setSepiaVal(e.target.value)}
114 | />
115 |
116 |
117 | Saturate
118 |
119 | setSaturateVal(e.target.value)}
130 | />
131 |
132 |
133 | Opacity
134 |
135 | setOpacityVal(e.target.value)}
146 | />
147 |
148 |
149 | Brightness
150 |
151 | setBrightnessVal(e.target.value)}
161 | />
162 |
163 |
164 | Contrast
165 |
166 | setContrastVal(e.target.value)}
176 | />
177 |
178 |
179 | Hue-rotate
180 |
181 | setHueVal(e.target.value)}
191 | />
192 |
193 |
194 | Invert
195 |
196 | setInvertVal(e.target.value)}
206 | />
207 |
212 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
233 |
234 |
235 |
236 |
245 |
246 |
247 |
248 |
249 | );
250 | };
251 |
252 | export default ImageFilter;
253 |
--------------------------------------------------------------------------------
/src/components/MarkdownGenerator/Html.js:
--------------------------------------------------------------------------------
1 | import ReactMarkdown from "react-markdown";
2 |
3 | const Html = ({ children }) => {
4 | return (
5 | <>
6 | {children}
7 | >
8 | );
9 | };
10 |
11 | export default Html;
12 |
--------------------------------------------------------------------------------
/src/components/MarkdownGenerator/Text.js:
--------------------------------------------------------------------------------
1 | import { Grid } from "@mui/material";
2 | import { Box } from "@mui/system";
3 | import React, { useState } from "react";
4 | import Html from "./Html";
5 |
6 | const Text = () => {
7 | const [inputVal, setInputVal] = useState("");
8 |
9 | return (
10 |
11 |
12 |
13 |
21 |
22 |
32 |
44 |
45 |
46 |
47 |
48 | );
49 | };
50 |
51 | export default Text;
52 |
--------------------------------------------------------------------------------
/src/components/MarkdownGenerator/index.js:
--------------------------------------------------------------------------------
1 | import { Typography } from "@mui/material";
2 | import UseTitle from "../../hooks/useTitle";
3 | import Text from "./Text";
4 |
5 | const MarkdownGenerator = () => {
6 | UseTitle("Magic CSS - Markdown");
7 | return (
8 | <>
9 |
16 | Markdown Generator
17 |
18 |
19 | >
20 | );
21 | };
22 |
23 | export default MarkdownGenerator;
24 |
--------------------------------------------------------------------------------
/src/components/ShadowGenerator.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import { SketchPicker } from "react-color";
3 | import {
4 | Button,
5 | Checkbox,
6 | FormControlLabel,
7 | FormGroup,
8 | Grid,
9 | Slider,
10 | Typography,
11 | } from "@mui/material";
12 | import { Container } from "@mui/system";
13 | import AssignmentIcon from "@mui/icons-material/Assignment";
14 | import UseTitle from "../hooks/useTitle";
15 | import { copyToClipboard } from "../utils/copyToClipboard";
16 |
17 | const ShadowGenerator = () => {
18 | const [x, setX] = useState(0);
19 | const [y, setY] = useState(0);
20 | const [blur, setBlur] = useState(0);
21 | const [spread, setSpread] = useState(0);
22 | const [insetStatus, setInsetStatus] = useState(false);
23 | const [color, setColor] = useState("#000");
24 | const [finalSource, setFinalSource] = useState();
25 |
26 | useEffect(() => {
27 | insetStatus
28 | ? setFinalSource(
29 | `box-shadow:inset ${x}px ${y}px ${blur}px ${spread}px ${color}`
30 | )
31 | : setFinalSource(
32 | `box-shadow:${x}px ${y}px ${blur}px ${spread}px ${color}`
33 | );
34 | }, [x, y, blur, spread, insetStatus, color]);
35 |
36 | UseTitle("Magic CSS - shadow generator");
37 | return (
38 |
39 |
40 |
41 |
51 |
52 |
53 |
54 | X
55 |
56 | setX(e.target.value)}
66 | />
67 |
68 | Y
69 |
70 | setY(e.target.value)}
80 | />
81 |
82 | Blur
83 |
84 | setBlur(e.target.value)}
94 | />
95 |
96 | Spread
97 |
98 | setSpread(e.target.value)}
108 | />
109 |
110 | setInsetStatus(!insetStatus)}
115 | color="success"
116 | />
117 | }
118 | label="Inset"
119 | />
120 |
121 |
122 | Color
123 |
124 | setColor(e.hex)}
128 | />
129 |
137 |
138 |
139 |
140 | );
141 | };
142 |
143 | export default ShadowGenerator;
144 |
--------------------------------------------------------------------------------
/src/components/Skew.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import { Button, Container, Grid, Slider, Typography } from "@mui/material";
3 | import { Box } from "@mui/system";
4 | import AssignmentIcon from "@mui/icons-material/Assignment";
5 | import UseTitle from "../hooks/useTitle";
6 | import { copyToClipboard } from "../utils/copyToClipboard";
7 |
8 | const Skew = () => {
9 | const [SkewX, setSkewX] = useState(0);
10 | const [SkewY, setSkewY] = useState(0);
11 | const [finalSource, setFinalSource] = useState("");
12 |
13 | useEffect(() => {
14 | setFinalSource(`transform: skew(${SkewX}deg, ${SkewY}deg);`);
15 | }, [SkewX, SkewY]);
16 |
17 | UseTitle("Magic CSS - Skew");
18 |
19 | return (
20 |
21 |
27 |
28 |
29 | Skew-X
30 |
31 | setSkewX(e.target.value)}
41 | />
42 |
43 |
44 | Skew-Y
45 |
46 | setSkewY(e.target.value)}
56 | />
57 |
58 |
67 |
68 |
69 |
70 |
78 |
79 |
80 |
81 | );
82 | };
83 |
84 | export default Skew;
85 |
--------------------------------------------------------------------------------
/src/components/TextEditor.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import {
3 | styled,
4 | Paper,
5 | ToggleButton,
6 | ToggleButtonGroup,
7 | Container,
8 | Grid,
9 | Stack,
10 | TextField,
11 | Typography,
12 | } from "@mui/material";
13 | import { Box } from "@mui/system";
14 | import FormatAlignLeftIcon from "@mui/icons-material/FormatAlignLeft";
15 | import FormatAlignCenterIcon from "@mui/icons-material/FormatAlignCenter";
16 | import FormatAlignRightIcon from "@mui/icons-material/FormatAlignRight";
17 | import FormatAlignJustifyIcon from "@mui/icons-material/FormatAlignJustify";
18 | import FormatBoldIcon from "@mui/icons-material/FormatBold";
19 | import FormatItalicIcon from "@mui/icons-material/FormatItalic";
20 | import FormatUnderlinedIcon from "@mui/icons-material/FormatUnderlined";
21 |
22 | const StyledToggleButtonGroup = styled(ToggleButtonGroup)(({ theme }) => ({
23 | "& .MuiToggleButtonGroup-grouped": {
24 | margin: theme.spacing(0.3),
25 | border: 0,
26 | "&.Mui-disabled": {
27 | border: 0,
28 | },
29 | "&:not(:first-of-type)": {
30 | borderRadius: theme.shape.borderRadius,
31 | },
32 | "&:first-of-type": {
33 | borderRadius: theme.shape.borderRadius,
34 | },
35 | },
36 | }));
37 |
38 | const TextEditor = () => {
39 | const [inputVal, setInputVal] = useState("");
40 | const [alignment, setAlignment] = useState("left");
41 | const [formats, setFormats] = useState("");
42 | const [finalSource, setFinalSource] = useState({});
43 |
44 | useEffect(() => {
45 | if (formats.includes("bold")) {
46 | setFinalSource({
47 | ...finalSource,
48 | "font-weight": "bold",
49 | "text-align": alignment,
50 | });
51 | } else if (formats.includes("italic")) {
52 | setFinalSource({
53 | ...finalSource,
54 | "font-style": "italic",
55 | "text-align": alignment,
56 | });
57 | } else if (formats.includes("underlined")) {
58 | setFinalSource({
59 | ...finalSource,
60 | "text-decoration": "underline",
61 | "text-align": alignment,
62 | });
63 | } else {
64 | setFinalSource({
65 | ...finalSource,
66 | "text-align": alignment,
67 | });
68 | }
69 | }, [alignment, setAlignment, formats]);
70 | // text format
71 | const handleFormat = (e, newFormats) => {
72 | setFormats(newFormats);
73 | };
74 | // text alignment
75 | const handleAlignment = (e, newAlignment) => {
76 | setAlignment(newAlignment);
77 | };
78 |
79 | return (
80 |
81 |
82 |
83 | `1px solid ${theme.palette.divider}`,
88 | flexWrap: "wrap",
89 | }}
90 | >
91 |
92 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | {/* text field */}
135 |
144 |
149 | setInputVal(e.target.value)}
155 | />
156 |
157 | {/* results */}
158 |
164 |
170 |
180 | {inputVal}
181 |
182 |
183 |
184 |
185 |
186 |
187 | );
188 | };
189 | export default TextEditor;
190 |
--------------------------------------------------------------------------------
/src/components/TextShadowGenerator.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import {
3 | Button,
4 | Container,
5 | Grid,
6 | Slider,
7 | TextField,
8 | Typography,
9 | } from "@mui/material";
10 | import { Box } from "@mui/system";
11 | import AssignmentIcon from "@mui/icons-material/Assignment";
12 | import { SketchPicker } from "react-color";
13 | import UseTitle from "../hooks/useTitle";
14 | import { copyToClipboard } from "../utils/copyToClipboard";
15 |
16 | const TextShadowGenerator = () => {
17 | const [testText, setTestText] = useState("");
18 | const [x, setX] = useState(0);
19 | const [y, setY] = useState(0);
20 | const [blur, setBlur] = useState(0);
21 | const [color, setColor] = useState("#000");
22 | const [finalSource, setFinalSource] = useState();
23 |
24 | useEffect(() => {
25 | setFinalSource(`${x}px ${y}px ${blur}px ${color}`);
26 | }, [x, y, blur, color]);
27 | UseTitle("Magic CSS - Text shadow");
28 |
29 | return (
30 |
31 |
32 |
41 | setTestText(e.target.value)}
47 | />
48 |
56 |
57 |
58 |
64 |
73 |
78 | {testText}
79 |
80 |
81 |
82 |
83 |
84 |
85 | X
86 |
87 | setX(e.target.value)}
97 | />
98 |
99 | Y
100 |
101 | setY(e.target.value)}
111 | />
112 |
113 | Blur
114 |
115 | setBlur(e.target.value)}
125 | />
126 |
127 | color
128 |
129 | setColor(e.hex)}
133 | />
134 |
135 |
136 |
137 | );
138 | };
139 |
140 | export default TextShadowGenerator;
141 |
--------------------------------------------------------------------------------
/src/components/donation/DonateCard.js:
--------------------------------------------------------------------------------
1 | import { copyToClipboard } from './../../utils/copyToClipboard';
2 | import {
3 | Button,
4 | Card,
5 | CardActions,
6 | CardContent,
7 | CardMedia,
8 | Typography,
9 | } from "@mui/material";
10 |
11 | const DonateCard = ({ data }) => {
12 | return (
13 |
17 |
24 |
25 |
31 | {data.walletTitle}
32 |
33 |
34 | {data.walletId}
35 |
36 |
37 |
38 |
46 |
47 |
48 | );
49 | };
50 |
51 | export default DonateCard;
--------------------------------------------------------------------------------
/src/components/donation/index.js:
--------------------------------------------------------------------------------
1 | import { Grid } from "@mui/material";
2 | import { Container } from "@mui/system";
3 | import DonateCard from "./DonateCard";
4 | import UseTitle from "../../hooks/useTitle";
5 | import { walletCards } from "../../constants/walletCards";
6 |
7 | const Donation = () => {
8 | UseTitle("Magic CSS - Donation");
9 | return (
10 |
11 |
12 | {walletCards.map((item) => (
13 |
14 |
15 |
16 | ))}
17 |
18 |
19 | );
20 | };
21 | export default Donation;
22 |
--------------------------------------------------------------------------------
/src/components/layout/Footer.js:
--------------------------------------------------------------------------------
1 | import { Grid, Typography } from "@mui/material";
2 |
3 | const Footer = () => {
4 | return (
5 |
13 |
14 |
20 | Made with
21 | ❤
22 | by
23 |
28 | {" "}
29 | Parham Abolghasemi
30 |
31 |
32 |
33 |
34 | );
35 | };
36 |
37 | export default Footer;
38 |
--------------------------------------------------------------------------------
/src/components/layout/Header.js:
--------------------------------------------------------------------------------
1 | import { useNavigate } from "react-router-dom";
2 | import { Link } from "react-router-dom";
3 | import Box from "@mui/material/Box";
4 | import Drawer from "@mui/material/Drawer";
5 | import CssBaseline from "@mui/material/CssBaseline";
6 | import AppBar from "@mui/material/AppBar";
7 | import Toolbar from "@mui/material/Toolbar";
8 | import List from "@mui/material/List";
9 | import Typography from "@mui/material/Typography";
10 | import { IconButton } from "@mui/material";
11 | import GitHubIcon from "@mui/icons-material/GitHub";
12 | import { AwesomeButton } from "react-awesome-button";
13 | import "react-awesome-button/dist/styles.css";
14 | import { menuItems } from "../../constants/menuItems";
15 |
16 | const Header = () => {
17 | const navigate = useNavigate();
18 | return (
19 |
20 |
31 |
32 | {menuItems.map((item) => (
33 | navigate(`${item.path}`)}>
34 |
40 | {item.icon}
41 |
42 |
43 | ))}
44 |
45 |
46 |
47 |
58 |
59 |
66 | Buy me a Coffee
67 |
68 |
69 |
70 |
76 | Magic CSS
77 |
78 |
79 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | );
92 | };
93 |
94 | export default Header;
95 |
--------------------------------------------------------------------------------
/src/components/layout/index.js:
--------------------------------------------------------------------------------
1 | import Header from "./Header";
2 | import Footer from "./Footer";
3 |
4 | const LayOut = ({ children }) => {
5 | return (
6 | <>
7 |
8 | {children}
9 |
10 | >
11 | );
12 | };
13 |
14 | export default LayOut;
--------------------------------------------------------------------------------
/src/constants/menuItems.js:
--------------------------------------------------------------------------------
1 | import GradientIcon from "@mui/icons-material/Gradient";
2 | import AutoFixNormalIcon from "@mui/icons-material/AutoFixNormal";
3 | import FormatColorTextIcon from "@mui/icons-material/FormatColorText";
4 | import VignetteIcon from "@mui/icons-material/Vignette";
5 | import AspectRatioIcon from "@mui/icons-material/AspectRatio";
6 | import ColorLensIcon from "@mui/icons-material/ColorLens";
7 | import ImageIcon from "@mui/icons-material/Image";
8 | import FormatSizeIcon from "@mui/icons-material/FormatSize";
9 | import FormatPaintIcon from "@mui/icons-material/FormatPaint";
10 | import { BsMarkdownFill } from "react-icons/bs";
11 |
12 | export const menuItems = [
13 | {
14 | text: "Shadow Generator",
15 | icon: (
16 |
17 | ),
18 | path: "/shadowGenerator",
19 | },
20 | {
21 | text: "gradient",
22 | icon: ,
23 | path: "/gradient",
24 | },
25 | {
26 | text: "TextShadowGenerator",
27 | icon: (
28 |
29 | ),
30 | path: "/TextShadowGenerator",
31 | },
32 | {
33 | text: "BorderRadius",
34 | icon: ,
35 | path: "/border-radius",
36 | },
37 | {
38 | text: "skew",
39 | icon: ,
40 | path: "/skew",
41 | },
42 | {
43 | text: "textGenerator",
44 | icon: ,
45 | path: "/color-picker",
46 | },
47 | {
48 | text: "textEditor",
49 | icon: ,
50 | path: "/text-editor",
51 | },
52 | {
53 | text: "colorGenerator",
54 | icon: ,
55 | path: "/color-generator",
56 | },
57 | {
58 | text: "markdownGenerator",
59 | icon: (
60 |
61 | ),
62 | path: "/markdown",
63 | },
64 | {
65 | text: "ImageFilter",
66 | icon: ,
67 | path: "/image-filter",
68 | },
69 | ];
70 |
--------------------------------------------------------------------------------
/src/constants/walletCards.js:
--------------------------------------------------------------------------------
1 | import ethImg from "../assets/img/eth.jpg";
2 | import usdtImg from "../assets/img/usdt.jpg";
3 | import usdcImg from "../assets/img/usdc.jpg";
4 | import adaImg from "../assets/img/ada.jpg";
5 | import dogeImg from "../assets/img/doge.jpg";
6 | import bnbImg from "../assets/img/bnb.jpg";
7 | import shibImg from "../assets/img/shib.jpg";
8 |
9 | export const walletCards = [
10 | {
11 | id: 1,
12 | walletTitle: "BTC Wallet",
13 | walletImg: "",
14 | walletId: "bc1qwsc3kg4ljflvd3ldc9kmnr42qrsvlzkyheyrln",
15 | },
16 | {
17 | id: 2,
18 | walletTitle: "ETH Wallet",
19 | walletImg: ethImg,
20 | walletId: "0x93AE27D02e008be123d5Eb6C7325cCaD2Ea39518",
21 | },
22 | {
23 | id: 3,
24 | walletTitle: "USDT Wallet",
25 | walletImg: usdtImg,
26 | walletId: "0x93AE27D02e008be123d5Eb6C7325cCaD2Ea39518",
27 | },
28 | {
29 | id: 4,
30 | walletTitle: "USDC Wallet",
31 | walletImg: usdcImg,
32 | walletId: "TE6z9XEufbnydPpvsAsx8UkozSxkP85j7x",
33 | },
34 | {
35 | id: 5,
36 | walletTitle: "ADA Wallet",
37 | walletImg: adaImg,
38 | walletId:
39 | "addr1q9sh84ktzwapz5mxdr4vkhjre0039w6ydym6eqvcjlvh93gfggvcgtv8pcv75779eauamqn28r78tlha4xamh8e8vugslnffnj",
40 | },
41 | {
42 | id: 6,
43 | walletTitle: "DOGE Wallet",
44 | walletImg: dogeImg,
45 | walletId: "DA5JhQM8Kh3JUF6nAwDebhFQHoZtG3roFY",
46 | },
47 | {
48 | id: 7,
49 | walletTitle: "BNB Wallet",
50 | walletImg: bnbImg,
51 | walletId: "bnb166k8dddfjg452q670fffk6s4ptr23ygll9dyzg",
52 | },
53 | {
54 | id: 8,
55 | walletTitle: "SHIB Wallet",
56 | walletImg: shibImg,
57 | walletId: "0x93AE27D02e008be123d5Eb6C7325cCaD2Ea39518",
58 | },
59 | ];
60 |
--------------------------------------------------------------------------------
/src/hooks/useTitle.js:
--------------------------------------------------------------------------------
1 | import { useEffect } from "react";
2 |
3 | const UseTitle = (title) => {
4 | useEffect(() => {
5 | document.title = title;
6 | }, []);
7 | };
8 |
9 | export default UseTitle;
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom/client";
3 | import App from "./App";
4 | import { BrowserRouter } from "react-router-dom";
5 | import "./assets/styles/index.scss";
6 |
7 | const root = ReactDOM.createRoot(document.getElementById("root"));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
--------------------------------------------------------------------------------
/src/routes/index.js:
--------------------------------------------------------------------------------
1 | import ShadowGenerator from "../components/ShadowGenerator";
2 | import Gradient from "../components/Gradient";
3 | import TextShadowGenerator from "../components/TextShadowGenerator";
4 | import BorderRadius from "../components/BorderRadius";
5 | import ImageFilter from "../components/ImageFilter";
6 | import Donate from "../components/donation";
7 | import Skew from "../components/Skew";
8 | import ColorPicker from "../components/ColorPicker";
9 | import ColorGenerator from "../components/ColorGenerator";
10 | import TextEditor from "../components/TextEditor";
11 | import MarkdownGenerator from "../components/MarkdownGenerator";
12 |
13 | const mainRoutes = [
14 | {
15 | title: "shadowGenerator",
16 | path: "/shadowGenerator",
17 | component: ShadowGenerator,
18 | },
19 | {
20 | title: "gradient",
21 | path: "/gradient",
22 | component: Gradient,
23 | },
24 | {
25 | title: "textShadowGenerator",
26 | path: "/textShadowGenerator",
27 | component: TextShadowGenerator,
28 | },
29 | {
30 | title: "border-radius",
31 | path: "/border-radius",
32 | component: BorderRadius,
33 | },
34 | {
35 | title: "image-filter",
36 | path: "/image-filter",
37 | component: ImageFilter,
38 | },
39 | {
40 | title: "skew",
41 | path: "/skew",
42 | component: Skew,
43 | },
44 | {
45 | title: "skew",
46 | path: "/skew",
47 | component: Skew,
48 | },
49 | {
50 | title: "color-picker",
51 | path: "/color-picker",
52 | component: ColorPicker,
53 | },
54 | {
55 | title: "color-generator",
56 | path: "/color-generator",
57 | component: ColorGenerator,
58 | },
59 | {
60 | title: "text-editor",
61 | path: "/text-editor",
62 | component: TextEditor,
63 | },
64 | {
65 | title: "donation",
66 | path: "/donation",
67 | component: Donate,
68 | },
69 | {
70 | title: "markdown",
71 | path: "/markdown",
72 | component: MarkdownGenerator,
73 | },
74 | ];
75 |
76 | export { mainRoutes as routes };
77 |
--------------------------------------------------------------------------------
/src/utils/ScrollTotop.js:
--------------------------------------------------------------------------------
1 | import { useEffect } from "react";
2 | import { useLocation } from "react-router-dom";
3 |
4 | export default function ScrollToTop() {
5 | const { pathname } = useLocation();
6 |
7 | useEffect(() => {
8 | window.scrollTo(0, 0);
9 | }, [pathname]);
10 |
11 | return null;
12 | }
13 |
--------------------------------------------------------------------------------
/src/utils/colorFormat.js:
--------------------------------------------------------------------------------
1 | function componentToHex(c) {
2 | var hex = c.toString(16);
3 | return hex.length === 1 ? "0" + hex : hex;
4 | }
5 |
6 | function rgbToHex(r, g, b) {
7 | return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
8 | }
9 |
10 | export default rgbToHex;
11 |
--------------------------------------------------------------------------------
/src/utils/copyToClipboard.js:
--------------------------------------------------------------------------------
1 | import { notify } from "./toast";
2 |
3 | export const copyToClipboard = (source) => {
4 | navigator.clipboard.writeText(source);
5 | notify("success", "Copied to clipboard ✔");
6 | };
7 |
--------------------------------------------------------------------------------
/src/utils/theme.js:
--------------------------------------------------------------------------------
1 | import { createTheme } from "@mui/material";
2 |
3 | export const theme = createTheme({
4 | typography: {
5 | fontFamily: ["Quicksand"].join(","),
6 | fontSize: 14,
7 | fontWeightLight: 400,
8 | fontWeightMedium: 500,
9 | fontWeightRegular: 600,
10 | fontWeightBold: 700,
11 | },
12 | });
13 |
--------------------------------------------------------------------------------
/src/utils/toast.js:
--------------------------------------------------------------------------------
1 | import { toast } from "react-toastify";
2 |
3 | export const notify = (type, text) => {
4 | if (type === "success") {
5 | toast.success(text, {
6 | position: "top-center",
7 | autoClose: 1500,
8 | hideProgressBar: false,
9 | closeOnClick: true,
10 | pauseOnHover: true,
11 | draggable: true,
12 | progress: undefined,
13 | theme: "dark",
14 | });
15 | } else if (type === "error") {
16 | toast.error(text, {
17 | position: "top-center",
18 | autoClose: 1500,
19 | hideProgressBar: false,
20 | closeOnClick: true,
21 | pauseOnHover: true,
22 | draggable: true,
23 | progress: undefined,
24 | theme: "dark",
25 | });
26 | }
27 | };
28 |
--------------------------------------------------------------------------------