Skip to content

Commit

Permalink
KEY-67 disabled future apply checkbox if select all apps switcher is …
Browse files Browse the repository at this point in the history
…false (#291)
  • Loading branch information
alonkeyval authored Jul 12, 2023
1 parent fb8da27 commit bcf33da
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export function SourcesOptionMenu({
label={SETUP.MENU.FUTURE_APPLY}
value={checked}
onChange={() => onFutureApplyChange(!checked)}
disabled={!toggle}
/>
<KeyvalTooltip content={SETUP.MENU.TOOLTIP} />
</CheckboxWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export function SetupSection({ namespaces }: any) {
currentNamespaceConfig = {
...currentNamespaceConfig,
selected_all: false,
future_selected: false,
};
}
handleSetNewSelectedConfig(currentNamespaceConfig);
Expand All @@ -97,7 +98,7 @@ export function SetupSection({ namespaces }: any) {
});

const currentNamespaceConfig = {
...namespace,
future_selected: value,
selected_all: value,
objects,
};
Expand Down
10 changes: 8 additions & 2 deletions frontend/webapp/design.system/checkbox/checkbox.styled.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { styled } from "styled-components";

export const CheckboxWrapper = styled.div`
interface CheckboxWrapperProps {
disabled?: boolean;
}

export const CheckboxWrapper = styled.div<CheckboxWrapperProps>`
display: flex;
gap: 8px;
align-items: center;
cursor: pointer;
cursor: ${({ disabled }) => (disabled ? "not-allowed" : "pointer")};
pointer-events: ${({ disabled }) => (disabled ? "none" : "auto")};
opacity: ${({ disabled }) => (disabled ? "0.5" : "1")};
`;

export const Checkbox = styled.span`
Expand Down
4 changes: 3 additions & 1 deletion frontend/webapp/design.system/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ interface KeyvalCheckboxProps {
value: boolean;
onChange: () => void;
label?: string;
disabled?: boolean;
}

export function KeyvalCheckbox({
onChange,
value,
label = "",
disabled = false,
}: KeyvalCheckboxProps) {
return (
<CheckboxWrapper onClick={onChange}>
<CheckboxWrapper disabled={disabled || undefined} onClick={onChange}>
{value ? <Checked /> : <Checkbox />}
<KeyvalText size={14}>{label}</KeyvalText>
</CheckboxWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const DropdownWrapper = styled.div<DropdownWrapperProps>`
width: 260px;
padding: 11px 13px;
border-radius: 8px;
cursor: pointer;
border: ${({ hover, theme }) =>
`1px solid ${hover ? theme.colors.white : theme.colors.blue_grey}`};
background: ${({ theme }) => theme.colors.dark};
Expand All @@ -25,7 +26,6 @@ export const DropdownWrapper = styled.div<DropdownWrapperProps>`
`;

export const DropdownHeader = styled.div`
cursor: pointer;
width: 100%;
display: flex;
justify-content: space-between;
Expand Down
3 changes: 2 additions & 1 deletion frontend/webapp/design.system/drop.down/drop.down.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ export function KeyvalDropDown({
hover={isHover || undefined}
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
onClick={toggleDropdown}
>
<DropdownHeader onClick={toggleDropdown}>
<DropdownHeader>
{selectedItem ? selectedItem.label : SELECTED_ITEM}
<Open className={`dropdown-arrow ${isOpen && "open"}`} />
</DropdownHeader>
Expand Down
2 changes: 1 addition & 1 deletion frontend/webapp/design.system/switch/switch.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface SwitchToggleWrapperProps {
}

interface SwitchToggleBtnProps {
disabled: boolean;
disabled: boolean | undefined;
}

export const SwitchInputWrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion frontend/webapp/design.system/switch/switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function KeyvalSwitch({
active={toggle || undefined}
onClick={handleToggleChange}
>
<SwitchButtonWrapper disabled={toggle} />
<SwitchButtonWrapper disabled={toggle || undefined} />
</SwitchToggleWrapper>
{label && <KeyvalText size={14}>{label}</KeyvalText>}
</SwitchInputWrapper>
Expand Down

0 comments on commit bcf33da

Please sign in to comment.