Skip to content

Commit

Permalink
Disable Buttons until Item has been selected
Browse files Browse the repository at this point in the history
  • Loading branch information
sergesoroka committed Feb 8, 2024
1 parent 0cd7308 commit 833075c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 13 deletions.
9 changes: 6 additions & 3 deletions src/IconsComponents/CopyFileIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";

export default function CopyFileIcon() {
export default function CopyFileIcon({ disabled }) {
return (
<svg
width="14"
Expand All @@ -11,9 +11,12 @@ export default function CopyFileIcon() {
>
<path
d="M12.9459 12.7353H4C3.72386 12.7353 3.5 12.5114 3.5 12.2353V1C3.5 0.723858 3.72386 0.5 4 0.5H10.2947C10.4255 0.5 10.551 0.551223 10.6445 0.64269L13.2957 3.23786C13.3918 3.33191 13.4459 3.46071 13.4459 3.59517V12.2353C13.4459 12.5114 13.2221 12.7353 12.9459 12.7353Z"
stroke="black"
stroke={disabled ? "#999999" : "black"}
/>
<path
d="M1 4.41177V14C1 14.5523 1.44772 15 2 15H10"
stroke={disabled ? "#999999" : "#000"}
/>
<path d="M1 4.41177V14C1 14.5523 1.44772 15 2 15H10" stroke="black" />
</svg>
);
}
1 change: 1 addition & 0 deletions src/MenuBar/Header.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
}
.uuid {
color: #282828;
margin: 0;
}
.saveUuid {
display: flex;
Expand Down
5 changes: 2 additions & 3 deletions src/StartScreenComp/StartScreenComp.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ table {
overflow-y: scroll;
overflow-x: hidden;
height: 285px;
scrollbar-color: #919191 #d5d5d5;
scrollbar-width: thin;
}
thead th {
position: sticky;
Expand Down Expand Up @@ -149,6 +151,3 @@ tr.choosen {
iframe {
border: none;
}

/* .previewPlaceholder {
} */
11 changes: 8 additions & 3 deletions src/StartScreenComp/StartScreenComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,28 @@ export default function StartScreenComp({
value={value}
mode={mode}
/>

<div className="buttonsWrap">
<div onClick={editORView}>
<Button label={mode == "Finalized" ? "View" : "Edit"} />
<Button
disabled={!UUID}
label={mode == "Finalized" ? "View" : "Edit"}
/>
</div>
<Button label="Make a copy" />
<Button disabled={!UUID} label="Make a copy" />
<div
onClick={() => {
copyLink();
setCopied(true);
}}
>
<Button
disabled={!UUID}
label={copied ? "Copied to clipboard!" : "Share a link"}
/>
</div>
<div onClick={dowloadXLS}>
<Button label="Download XLS" />
<Button disabled={!UUID} label="Download XLS" />
</div>
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/ui/Button.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ leading-none rounded text-violet11 text-[14px] hover:bg-indigo-100 */
color: #282828;
}

.buttonMenu:hover {
.buttonMenu:hover:enabled {
background-color: #c8edff;
outline: none;
border: none;
Expand All @@ -21,3 +21,8 @@ leading-none rounded text-violet11 text-[14px] hover:bg-indigo-100 */
outline: none;
border: none;
}
button:disabled,
button[disabled] {
background-color: #e7e7e7;
color: #919191;
}
8 changes: 5 additions & 3 deletions src/ui/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import PublishIcon from "../IconsComponents/PublishIcon";
import SaveIcon from "../IconsComponents/SaveIcon";
import "./Button.css";

export default function Button({ label }) {
export default function Button({ label, disabled }) {
return (
<button className="buttonMenu">
<button className="buttonMenu" disabled={disabled ? true : false}>
{label == "New" && <NewFileIcon />}
{label == "Make a copy" && <CopyFileIcon />}
{label == "Make a copy" && (
<CopyFileIcon disabled={disabled ? true : false} />
)}
{label == "Open" && <OpenFileIcon />}
{label == "Publish" && <PublishIcon />}
{label == "Save" && <SaveIcon />}
Expand Down

0 comments on commit 833075c

Please sign in to comment.