We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As a user,
I want to add a color to the theme,
So that I can customize my color scheme according to my preferences.
ColorForm
ColorInput
./Components/ColorForm/ColorForm.jsx
import ColorInput from "../ColorInput/ColorInput"; import "./ColorForm.css"; export default function ColorForm({ onSubmitColor, initialData = { role: "some color", hex: "#123456", contrastText: "#ffffff" }, }) { function handleSubmit(event) { event.preventDefault(); const formData = new FormData(event.target); const data = Object.fromEntries(formData); onSubmitColor(data); } return ( <form className="color-form" onSubmit={handleSubmit}> <label htmlFor="role"> Role <br /> <input type="text" id="role" name="role" defaultValue={initialData.role} /> </label> <br /> <label htmlFor="hex"> Hex <br /> <ColorInput id="hex" defaultValue={initialData.hex} /> </label> <br /> <label htmlFor="contrastText"> Contrast Text <br /> <ColorInput id="contrastText" defaultValue={initialData.contrastText} /> </label> <br /> <button>ADD COLOR</button> </form> ); }
./ColorInput/ColorInput
import { useState } from "react"; export default function ColorInput({ id, defaultValue }) { const [inputValue, setInputValue] = useState(defaultValue); function handleInputValue(event) { setInputValue(event.target.value); } return ( <> <input type="text" id={id} name={id} value={inputValue} onChange={handleInputValue} /> <input type="color" value={inputValue} onChange={handleInputValue} /> </> ); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
As a user,
I want to add a color to the theme,
So that I can customize my color scheme according to my preferences.
Screen.Recording.2024-04-29.at.17.32.28.mov
Acceptance Criteria
Tasks
ColorForm
component that allows users to submit new colors to the theme.ColorInput
component to handle synchronized text and color inputs, ensuring that they reflect the same value. ( Controlled Inputs )Hints
Hint: ColorForm- Spoiler Alert! 🚨
./Components/ColorForm/ColorForm.jsx
Hint: ColorInput - Spoiler Alert! 🚨
./ColorInput/ColorInput
The text was updated successfully, but these errors were encountered: