mirror of
https://github.com/theoleuthardt/werkzeugkiste.git
synced 2026-06-13 09:37:53 +00:00
Merge pull request #13 from theoleuthardt/feat/regex-tester
feat: regex-tester fully implemented
This commit is contained in:
commit
1399809ebb
14 changed files with 323 additions and 130 deletions
|
|
@ -30,6 +30,7 @@ files, generate content, or using other handy digital utilities. This page is ma
|
|||
To install and run the project locally, follow these steps:
|
||||
|
||||
1. **Clone the repository**:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/theoleuthardt/werkzeugkiste.git
|
||||
cd werkzeugkiste
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ import cors from "@fastify/cors";
|
|||
import multipart from "@fastify/multipart";
|
||||
import { libreConvert } from "./src/routes/libreconvert.route";
|
||||
import { colorConvert } from "./src/routes/colorconvert.route";
|
||||
import {passwordGenerate} from "./src/routes/passwordgenerate.route";
|
||||
import { passwordGenerate } from "./src/routes/passwordgenerate.route";
|
||||
import { regexTest } from "./src/routes/regextest.route";
|
||||
|
||||
const app = Fastify({ logger: true });
|
||||
|
||||
|
|
@ -17,6 +18,7 @@ app.register(multipart);
|
|||
app.register(libreConvert);
|
||||
app.register(colorConvert);
|
||||
app.register(passwordGenerate);
|
||||
app.register(regexTest);
|
||||
|
||||
const PORT = process.env.PORT || 4000;
|
||||
app.listen({ port: Number(PORT), host: "0.0.0.0" }, () => {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ export async function colorConvert(app: FastifyInstance) {
|
|||
if (!data) {
|
||||
return reply.status(400).send({ error: "No RGB declared!" });
|
||||
}
|
||||
const hex = (`#${(+data.red).toString(16).padStart(2, "0")}${(+data.green).toString(16).padStart(2, "0")}${(+data.blue).toString(16).padStart(2, "0")}`).toUpperCase();
|
||||
const hex =
|
||||
`#${(+data.red).toString(16).padStart(2, "0")}${(+data.green).toString(16).padStart(2, "0")}${(+data.blue).toString(16).padStart(2, "0")}`.toUpperCase();
|
||||
reply.header("Content-Type", "text/plain").status(200).send(hex);
|
||||
} catch (error) {
|
||||
console.error("Convert error:", error);
|
||||
|
|
|
|||
|
|
@ -1,60 +1,62 @@
|
|||
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
||||
|
||||
interface RequestBody {
|
||||
length: string;
|
||||
numb: boolean;
|
||||
lower: boolean;
|
||||
upper: boolean;
|
||||
special: boolean;
|
||||
length: string;
|
||||
numb: boolean;
|
||||
lower: boolean;
|
||||
upper: boolean;
|
||||
special: boolean;
|
||||
}
|
||||
|
||||
export async function passwordGenerate(app: FastifyInstance) {
|
||||
app.post(
|
||||
"/api/password-generate",
|
||||
async (
|
||||
request: FastifyRequest<{ Body: RequestBody }>,
|
||||
reply: FastifyReply,
|
||||
) => {
|
||||
try {
|
||||
const data = request.body;
|
||||
if (!data) {
|
||||
return reply.status(400).send({ error: "No length or type declared!" });
|
||||
}
|
||||
let numArray: string[] = "0123456789".split("");
|
||||
let lowerArray: string[] = "abcdefghijklmnopqrstuvwxyz".split("");
|
||||
let upperArray: string[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
||||
let specialArray: string[] = "!@#$%^&*()_+[]{}|;:,.<>?".split("");
|
||||
let passwordArray: string[] = [];
|
||||
app.post(
|
||||
"/api/password-generate",
|
||||
async (
|
||||
request: FastifyRequest<{ Body: RequestBody }>,
|
||||
reply: FastifyReply,
|
||||
) => {
|
||||
try {
|
||||
const data = request.body;
|
||||
if (!data) {
|
||||
return reply
|
||||
.status(400)
|
||||
.send({ error: "No length or type declared!" });
|
||||
}
|
||||
let numArray: string[] = "0123456789".split("");
|
||||
let lowerArray: string[] = "abcdefghijklmnopqrstuvwxyz".split("");
|
||||
let upperArray: string[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
||||
let specialArray: string[] = "!@#$%^&*()_+[]{}|;:,.<>?".split("");
|
||||
let passwordArray: string[] = [];
|
||||
|
||||
if(data.numb){
|
||||
passwordArray = passwordArray.concat(numArray);
|
||||
}
|
||||
if (data.numb) {
|
||||
passwordArray = passwordArray.concat(numArray);
|
||||
}
|
||||
|
||||
if(data.lower){
|
||||
passwordArray = passwordArray.concat(lowerArray);
|
||||
}
|
||||
if (data.lower) {
|
||||
passwordArray = passwordArray.concat(lowerArray);
|
||||
}
|
||||
|
||||
if(data.upper){
|
||||
passwordArray = passwordArray.concat(upperArray);
|
||||
}
|
||||
if (data.upper) {
|
||||
passwordArray = passwordArray.concat(upperArray);
|
||||
}
|
||||
|
||||
if(data.special){
|
||||
passwordArray = passwordArray.concat(specialArray);
|
||||
}
|
||||
if (data.special) {
|
||||
passwordArray = passwordArray.concat(specialArray);
|
||||
}
|
||||
|
||||
let password = "";
|
||||
let password = "";
|
||||
|
||||
for (let i = 0; i < +data.length; i++) {
|
||||
const ind: number = Math.floor(Math.random() * passwordArray.length);
|
||||
const randomElement: string = passwordArray[ind];
|
||||
password = password.concat(randomElement);
|
||||
}
|
||||
for (let i = 0; i < +data.length; i++) {
|
||||
const ind: number = Math.floor(Math.random() * passwordArray.length);
|
||||
const randomElement: string = passwordArray[ind];
|
||||
password = password.concat(randomElement);
|
||||
}
|
||||
|
||||
reply.header("Content-Type", "text/plain").status(200).send(password);
|
||||
} catch (error) {
|
||||
console.error("Convert error:", error);
|
||||
reply.status(500).send({ error: "Error while converting!" });
|
||||
}
|
||||
},
|
||||
);
|
||||
reply.header("Content-Type", "text/plain").status(200).send(password);
|
||||
} catch (error) {
|
||||
console.error("Convert error:", error);
|
||||
reply.status(500).send({ error: "Error while converting!" });
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
52
backend/src/routes/regextest.route.ts
Normal file
52
backend/src/routes/regextest.route.ts
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
||||
|
||||
interface RequestBody {
|
||||
regex: string;
|
||||
test: string;
|
||||
}
|
||||
|
||||
export async function regexTest(app: FastifyInstance) {
|
||||
app.post(
|
||||
"/api/regex-test",
|
||||
async (
|
||||
request: FastifyRequest<{ Body: RequestBody }>,
|
||||
reply: FastifyReply,
|
||||
) => {
|
||||
try {
|
||||
const data = request.body;
|
||||
if (!data) {
|
||||
return reply.status(400).send({ error: "No Regex declared!" });
|
||||
}
|
||||
|
||||
if (!data.regex || !data.test) {
|
||||
return reply
|
||||
.status(400)
|
||||
.send({ error: "Regex or test string missing!" });
|
||||
}
|
||||
|
||||
let regexPattern;
|
||||
try {
|
||||
regexPattern = new RegExp(data.regex);
|
||||
} catch (e) {
|
||||
return reply
|
||||
.status(400)
|
||||
.send({ error: "Invalid regular expression!" });
|
||||
}
|
||||
|
||||
const result = regexPattern.test(data.test);
|
||||
|
||||
let output = "";
|
||||
if (result) {
|
||||
output = `The input matches the regular expression!`;
|
||||
} else {
|
||||
output = `The input does not match the regular expression.`;
|
||||
}
|
||||
|
||||
reply.header("Content-Type", "text/plain").status(200).send(output);
|
||||
} catch (error) {
|
||||
console.error("Convert error:", error);
|
||||
reply.status(500).send({ error: "Error while converting!" });
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
@ -3,18 +3,18 @@ import type { Metadata } from "next";
|
|||
import { toolLinks } from "@/constants";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: toolLinks[2].title,
|
||||
title: toolLinks[5].title,
|
||||
description: "Generator for secure strong passwords!",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={`antialiased`}>{children}</body>
|
||||
<body className={`antialiased`}>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,19 +6,21 @@ import Footer from "../../components/Footer";
|
|||
import Button from "../../components/Button";
|
||||
|
||||
export default function RgbToHex() {
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [password, setPassword] = useState("");
|
||||
|
||||
const generatePassword = async () => {
|
||||
|
||||
setLoading(true);
|
||||
|
||||
const length = (document.getElementById("length") as HTMLInputElement).value;
|
||||
const length = (document.getElementById("length") as HTMLInputElement)
|
||||
.value;
|
||||
const numb = (document.getElementById("numb") as HTMLInputElement).checked;
|
||||
const lower = (document.getElementById("lower") as HTMLInputElement).checked;
|
||||
const upper = (document.getElementById("upper") as HTMLInputElement).checked;
|
||||
const special = (document.getElementById("special") as HTMLInputElement).checked;
|
||||
const lower = (document.getElementById("lower") as HTMLInputElement)
|
||||
.checked;
|
||||
const upper = (document.getElementById("upper") as HTMLInputElement)
|
||||
.checked;
|
||||
const special = (document.getElementById("special") as HTMLInputElement)
|
||||
.checked;
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
|
|
@ -28,7 +30,13 @@ export default function RgbToHex() {
|
|||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ length: length, numb: numb, lower: lower, upper: upper, special: special }),
|
||||
body: JSON.stringify({
|
||||
length: length,
|
||||
numb: numb,
|
||||
lower: lower,
|
||||
upper: upper,
|
||||
special: special,
|
||||
}),
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
|
|
@ -37,7 +45,6 @@ export default function RgbToHex() {
|
|||
const password: string = await response.text();
|
||||
console.log(password);
|
||||
setPassword(password);
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error while converting:", error);
|
||||
alert("Error while converting");
|
||||
|
|
@ -61,10 +68,10 @@ export default function RgbToHex() {
|
|||
};
|
||||
|
||||
const checkInput = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const length = (document.getElementById(event.target.id) as HTMLInputElement);
|
||||
const length = document.getElementById(event.target.id) as HTMLInputElement;
|
||||
const lengthValue = +length.value;
|
||||
|
||||
if (lengthValue < 1 || lengthValue > 64 ) {
|
||||
if (lengthValue < 1 || lengthValue > 64) {
|
||||
alert("Invalid input. Please enter a number between 1 and 64.");
|
||||
}
|
||||
if (lengthValue < 1) {
|
||||
|
|
@ -72,55 +79,67 @@ export default function RgbToHex() {
|
|||
} else if (lengthValue > 64) {
|
||||
length.value = "64";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="h-screen w-screen bg-black text-white font-noto flex flex-col items-center">
|
||||
<Navbar renderHomeLink={true} />
|
||||
<div className="w-screen h-screen flex flex-col items-center justify-center">
|
||||
<h2 className="text-5xl font-bold text-white mb-16">password-generator</h2>
|
||||
<h2 className="text-5xl font-bold text-white mb-16">
|
||||
password-generator
|
||||
</h2>
|
||||
<div className="border-2 border-white p-3 rounded-xl text-center text-white flex flex-row justify-between">
|
||||
<div className="flex flex-col items-start">
|
||||
<label className="mx-2" htmlFor="length">length:</label>
|
||||
<label className="mx-2 text-white" htmlFor="numb">numbers</label>
|
||||
<label className="mx-2" htmlFor="lower">lower case characters</label>
|
||||
<label className="mx-2" htmlFor="upper">upper case characters</label>
|
||||
<label className="mx-2" htmlFor="special">special characters</label>
|
||||
<label className="mx-2" htmlFor="length">
|
||||
length:
|
||||
</label>
|
||||
<label className="mx-2 text-white" htmlFor="numb">
|
||||
numbers
|
||||
</label>
|
||||
<label className="mx-2" htmlFor="lower">
|
||||
lower case characters
|
||||
</label>
|
||||
<label className="mx-2" htmlFor="upper">
|
||||
upper case characters
|
||||
</label>
|
||||
<label className="mx-2" htmlFor="special">
|
||||
special characters
|
||||
</label>
|
||||
</div>
|
||||
<div className="flex flex-col items-end justify-evenly gap-2">
|
||||
<input
|
||||
type="number"
|
||||
id="length"
|
||||
name="length"
|
||||
min="1"
|
||||
max="64"
|
||||
className="w-16 bg-black border-1 border-white text-center"
|
||||
onInput={checkInput}
|
||||
type="number"
|
||||
id="length"
|
||||
name="length"
|
||||
min="1"
|
||||
max="64"
|
||||
className="w-16 bg-black border-1 border-white text-center"
|
||||
onInput={checkInput}
|
||||
/>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="numb"
|
||||
name="numb"
|
||||
className="w-16 bg-black border-1 border-white text-center"
|
||||
type="checkbox"
|
||||
id="numb"
|
||||
name="numb"
|
||||
className="w-16 bg-black border-1 border-white text-center"
|
||||
/>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="lower"
|
||||
name="lower"
|
||||
className="w-16 bg-black border-1 border-white text-center"
|
||||
/>
|
||||
<input
|
||||
<input
|
||||
type="checkbox"
|
||||
id="lower"
|
||||
name="lower"
|
||||
className="w-16 bg-black border-1 border-white text-center"
|
||||
/>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="upper"
|
||||
name="upper"
|
||||
className="w-16 bg-black border-1 border-white text-center"
|
||||
/>
|
||||
<input
|
||||
/>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="special"
|
||||
name="special"
|
||||
className="w-16 bg-black border-1 border-white text-center"
|
||||
/>
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className={"flex flex-row items-center gap-4 mt-4 mb-16"}>
|
||||
|
|
@ -134,16 +153,12 @@ export default function RgbToHex() {
|
|||
}
|
||||
onClick={generatePassword}
|
||||
/>
|
||||
<Button
|
||||
content="clear"
|
||||
onClick={clearInAndOutput}
|
||||
/>
|
||||
</div>
|
||||
<Button content="clear" onClick={clearInAndOutput} />
|
||||
</div>
|
||||
<div className="p-3 rounded-xl text-center">
|
||||
<output
|
||||
id="password"
|
||||
className="text-blue-400 text-3xl"
|
||||
>{password}</output>
|
||||
<output id="password" className="text-blue-400 text-3xl">
|
||||
{password}
|
||||
</output>
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
|
|
|
|||
20
frontend/src/app/regex-tester/layout.tsx
Normal file
20
frontend/src/app/regex-tester/layout.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import React from "react";
|
||||
import type { Metadata } from "next";
|
||||
import { toolLinks } from "@/constants";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: toolLinks[3].title,
|
||||
description: "Tester for regular expressions!",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={`antialiased`}>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
102
frontend/src/app/regex-tester/page.tsx
Normal file
102
frontend/src/app/regex-tester/page.tsx
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import Navbar from "../../components/Navbar";
|
||||
import Footer from "../../components/Footer";
|
||||
import Button from "../../components/Button";
|
||||
|
||||
export default function RgbToHex() {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [output, setOutput] = useState("");
|
||||
|
||||
const testRegex = async () => {
|
||||
setLoading(true);
|
||||
|
||||
const regex = (document.getElementById("regex") as HTMLInputElement).value;
|
||||
const test = (document.getElementById("test") as HTMLInputElement).value;
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
process.env.backend_url + "/api/regex-test",
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ regex: regex, test: test }),
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
return new Error(`Error: ${response.statusText}`);
|
||||
}
|
||||
const output: string = await response.text();
|
||||
console.log(output);
|
||||
setOutput(output);
|
||||
} catch (error) {
|
||||
console.error("Error while converting:", error);
|
||||
alert("Error while converting");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const clearInAndOutput = () => {
|
||||
setOutput("");
|
||||
const regex = document.getElementById("regex") as HTMLInputElement;
|
||||
const test = document.getElementById("test") as HTMLInputElement;
|
||||
test.value = "";
|
||||
regex.value = "";
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="h-screen w-screen bg-black text-white font-noto flex flex-col items-center">
|
||||
<Navbar renderHomeLink={true} />
|
||||
<div className="w-screen h-screen flex flex-col items-center justify-center">
|
||||
<h2 className="text-5xl font-bold text-white mb-16">regex-tester</h2>
|
||||
<div className="border-2 border-white p-3 rounded-xl text-center text-white flex flex-col justify-between">
|
||||
<div>
|
||||
<label className="mr-2 m" htmlFor="regex">
|
||||
regex:
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="regex"
|
||||
name="regex"
|
||||
className="field-sizing-content bg-black border-1 border-white text-center mb-3"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="mr-2" htmlFor="test">
|
||||
test string:
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="test"
|
||||
name="test"
|
||||
className="field-sizing-content bg-black border-1 border-white text-center"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className={"flex flex-row items-center gap-4 mt-4 mb-16"}>
|
||||
<Button
|
||||
content={
|
||||
loading ? (
|
||||
<div className="h-10 w-10 border-8 border-blue-100 border-t-blue-500 rounded-full animate-spin" />
|
||||
) : (
|
||||
"test"
|
||||
)
|
||||
}
|
||||
onClick={testRegex}
|
||||
/>
|
||||
<Button content="clear" onClick={clearInAndOutput} />
|
||||
</div>
|
||||
<div className="p-3 rounded-xl text-center">
|
||||
<output id="output" className="text-blue-400 text-3xl">
|
||||
{output}
|
||||
</output>
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -8,13 +8,13 @@ export const metadata: Metadata = {
|
|||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={`antialiased`}>{children}</body>
|
||||
<body className={`antialiased`}>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
|
@ -6,12 +6,10 @@ import Footer from "../../components/Footer";
|
|||
import Button from "../../components/Button";
|
||||
|
||||
export default function RgbToHex() {
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [hex, setHex] = useState("");
|
||||
|
||||
const convertToHex = async () => {
|
||||
|
||||
setLoading(true);
|
||||
|
||||
const red = (document.getElementById("red") as HTMLInputElement).value;
|
||||
|
|
@ -26,7 +24,7 @@ export default function RgbToHex() {
|
|||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ red: red, green: green, blue: blue }),
|
||||
body: JSON.stringify({ red: red, green: green, blue: blue }),
|
||||
},
|
||||
);
|
||||
if (!response.ok) {
|
||||
|
|
@ -34,7 +32,6 @@ export default function RgbToHex() {
|
|||
}
|
||||
const hex: string = await response.text();
|
||||
setHex(hex);
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error while converting:", error);
|
||||
alert("Error while converting");
|
||||
|
|
@ -54,10 +51,10 @@ export default function RgbToHex() {
|
|||
};
|
||||
|
||||
const checkInput = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const color = (document.getElementById(event.target.id) as HTMLInputElement);
|
||||
const color = document.getElementById(event.target.id) as HTMLInputElement;
|
||||
const colorValue = +color.value;
|
||||
|
||||
if (colorValue < 0 || colorValue > 255 ) {
|
||||
if (colorValue < 0 || colorValue > 255) {
|
||||
alert("Invalid input. Please enter a number between 0 and 255.");
|
||||
}
|
||||
if (colorValue < 0) {
|
||||
|
|
@ -65,7 +62,7 @@ export default function RgbToHex() {
|
|||
} else if (colorValue > 255) {
|
||||
color.value = "255";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="h-screen w-screen bg-black text-white font-noto flex flex-col items-center">
|
||||
|
|
@ -73,7 +70,9 @@ export default function RgbToHex() {
|
|||
<div className="w-screen h-screen flex flex-col items-center justify-center">
|
||||
<h2 className="text-5xl font-bold text-white mb-16">rgb-to-hex</h2>
|
||||
<div className="border-2 border-white p-3 rounded-xl text-center text-white">
|
||||
<label className="mr-2" htmlFor="red">Red:</label>
|
||||
<label className="mr-2" htmlFor="red">
|
||||
Red:
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
id="red"
|
||||
|
|
@ -83,7 +82,9 @@ export default function RgbToHex() {
|
|||
className="w-16 bg-black border-1 border-white text-center"
|
||||
onInput={checkInput}
|
||||
/>
|
||||
<label className="mx-2 text-white" htmlFor="green">Green:</label>
|
||||
<label className="mx-2 text-white" htmlFor="green">
|
||||
Green:
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
id="green"
|
||||
|
|
@ -93,7 +94,9 @@ export default function RgbToHex() {
|
|||
className="w-16 bg-black border-1 border-white text-center"
|
||||
onChange={checkInput}
|
||||
/>
|
||||
<label className="mx-2" htmlFor="blue">Blue:</label>
|
||||
<label className="mx-2" htmlFor="blue">
|
||||
Blue:
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
id="blue"
|
||||
|
|
@ -115,16 +118,12 @@ export default function RgbToHex() {
|
|||
}
|
||||
onClick={convertToHex}
|
||||
/>
|
||||
<Button
|
||||
content="clear"
|
||||
onClick={clearInAndOutput}
|
||||
/>
|
||||
</div>
|
||||
<Button content="clear" onClick={clearInAndOutput} />
|
||||
</div>
|
||||
<div className="p-3 rounded-xl text-center">
|
||||
<output
|
||||
id="hex"
|
||||
className="text-blue-400 text-3xl"
|
||||
>{hex}</output>
|
||||
<output id="hex" className="text-blue-400 text-3xl">
|
||||
{hex}
|
||||
</output>
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ export const toolLinks = [
|
|||
link: "/rgb-to-hex",
|
||||
},
|
||||
{
|
||||
title: "data-visualizer",
|
||||
link: "/data-visualizer",
|
||||
title: "regex-tester",
|
||||
link: "/regex-tester",
|
||||
},
|
||||
{
|
||||
title: "qr-code-generator",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue