Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #125 from SE-TINF22B6/fix_Stars
Browse files Browse the repository at this point in the history
fixed star design added function to disable button added enter key event
mirak55 authored Jun 12, 2024
2 parents 2c9fa06 + 817317f commit fd6630d
Showing 4 changed files with 17 additions and 20 deletions.
Binary file modified Cookpit.db
Binary file not shown.
8 changes: 6 additions & 2 deletions frontend/src/components/SearchSite/SearchSite.tsx
Original file line number Diff line number Diff line change
@@ -89,14 +89,18 @@ export default function SearchSite({ allRecipes }: { allRecipes: any[] }) {
setSearchInput(event.target.value);
};


const handleKeyDown = (event: React.KeyboardEvent) => {
if (event.key === 'Enter') {
handleSearch();
}
};

return (
<div id="outer_wrapper">
<div id="i_wrapper">
<div id="search_box_out_wrapper">
<div id="search_box_wrapper">
<input type="text" placeholder="Search..." value={searchInput} onChange={handleSearchInput}/>
<input type="text" placeholder="Search..." value={searchInput} onChange={handleSearchInput} onKeyDown={handleKeyDown}/>
<button onClick={handleSearch}>
<svg
xmlns="http://www.w3.org/2000/svg"
22 changes: 5 additions & 17 deletions frontend/src/components/recipeUpload/recipeUpload.css
Original file line number Diff line number Diff line change
@@ -186,17 +186,6 @@
align-items: center;
}

.uploadImageLabel:hover {
background-color: #ff9595;
box-shadow: 0px 15px 20px rgb(255, 152, 152);
color: #fff;
transform: translateY(-7px);
}

.uploadImageLabel:active {
transform: translateY(-1px);
}

.addOneMoreIngredient {
display: flex;
align-items: flex-start;
@@ -604,19 +593,18 @@ th {

.form-container .form-groupDifficulty label {
display: block;
padding-left: 8%;
padding-left: 2%;
color: #717171;
font-weight: 700;
font-size: 16px;
text-transform: uppercase;
}

.rating {
align-items: flex-start;
align-self: flex-start;
float: left;
min-height: 10%;
min-width: 40%;
width: 100%;
min-width: 50px;
width: 120px;
}

.rating:not(:checked) > input {
@@ -625,7 +613,7 @@ th {
}

.rating:not(:checked) > label {
display: inline-block;
float: right;
cursor: pointer;
font-size: 25px;
color: #666;
7 changes: 6 additions & 1 deletion frontend/src/components/recipeUpload/recipeUpload.tsx
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ export default function Body(props: Props) {
const [ingredients, setIngredients] = useState<string[]>([]);
const [steps, setSteps] = useState<string[]>([]);
const [file, setFile] = useState<File | null>(null);
const [isButtonDisabled, setIsButtonDisabled] = useState(false);

const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const selectedFile = event.target.files?.[0];
@@ -140,6 +141,8 @@ export default function Body(props: Props) {

const handleClick = () => {
navigate("/");
setIsButtonDisabled(true);
setTimeout(() => setIsButtonDisabled(false), 5000);
};

return (
@@ -307,9 +310,11 @@ export default function Body(props: Props) {

<button
className="addOneMoreIngredient"
disabled={isButtonDisabled}
onClick={() => {
addRecipe();
handleClick();
// handleClick();

}}
>
Rezept speichern

0 comments on commit fd6630d

Please sign in to comment.