Skip to content

Commit

Permalink
Added redesign of ExpirySelector and max button
Browse files Browse the repository at this point in the history
  • Loading branch information
makkelie-dev committed Sep 25, 2024
1 parent 950f8ed commit 68384c3
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 43 deletions.
19 changes: 9 additions & 10 deletions src/components/@widgets/MakeWidget/MakeWidget.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import ActionButtons from "./subcomponents/ActionButtons/ActionButtons";
import AddressInput from "./subcomponents/AddressInput/AddressInput";
import { ExpirySelector } from "./subcomponents/ExpirySelector/ExpirySelector";
import InfoSection from "./subcomponents/InfoSection/InfoSection";
import InputSection from "./subcomponents/InputSection/InputSection";
import OrderTypeSelector from "./subcomponents/OrderTypeSelector/OrderTypeSelector";
import { RateField } from "./subcomponents/RateField/RateField";

Expand Down Expand Up @@ -37,15 +36,6 @@ export const StyledOrderTypeSelector = styled(OrderTypeSelector)`
}
`;

export const StyledRateField = styled(RateField)`
margin-inline: auto;
padding-block-start: 0.25rem;
@media ${breakPoints.phoneOnly} {
width: auto;
}
`;

export const OrderTypeSelectorAndExpirySelectorWrapper = styled.div`
display: flex;
justify-content: space-between;
Expand Down Expand Up @@ -99,3 +89,12 @@ export const TooltipContainer = styled.div`
flex-direction: column;
position: relative;
`;

export const StyledRateField = styled(RateField)`
margin-inline: auto;
margin-block-start: 1rem;
@media ${breakPoints.phoneOnly} {
width: auto;
}
`;
27 changes: 14 additions & 13 deletions src/components/@widgets/MakeWidget/MakeWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -469,19 +469,6 @@ const MakeWidget: FC = () => {
/>
</OrderTypeSelectorAndExpirySelectorWrapper>

{makerTokenInfo &&
takerTokenInfo &&
!hasMissingMakerAmount &&
!hasMissingTakerAmount && (
<StyledRateField
token1={makerTokenInfo.symbol}
token2={takerTokenInfo.symbol}
rate={new BigNumber(takerAmount).dividedBy(
new BigNumber(makerAmount)
)}
/>
)}

{orderType === OrderType.private && (
<TooltipContainer>
<StyledAddressInput
Expand Down Expand Up @@ -524,6 +511,20 @@ const MakeWidget: FC = () => {
onBackButtonClick={handleBackButtonClick}
onActionButtonClick={handleActionButtonClick}
/>

{makerTokenInfo &&
takerTokenInfo &&
!hasMissingMakerAmount &&
!hasMissingTakerAmount && (
<StyledRateField
token1={makerTokenInfo.symbol}
token2={takerTokenInfo.symbol}
rate={new BigNumber(takerAmount).dividedBy(
new BigNumber(makerAmount)
)}
/>
)}

<Overlay
onClose={() => setShowTokenSelectModal(null)}
isHidden={!showTokenSelectModal}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const Input = styled(TextInput)`
${({ hasError, theme }) =>
hasError ? `border-color: ${theme.colors.red}` : ""};
border-radius: 2px;
border-radius: 0.5rem;
padding-right: 3.5rem;
padding-left: 1rem;
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const Input = styled.input`
all: unset;
${SelectorStyle};
${InputOrButtonBorderStyleType2};
width: 2.5rem;
text-align: center;
Expand All @@ -60,6 +61,8 @@ export const Input = styled.input`
`;

export const StyledDropdown = styled(Dropdown)`
margin-inline-start: -1px;
${SelectButtonText} {
max-width: 7rem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export const Wrapper = styled.div<{ isButton: boolean }>`
font-family: ${fontWide};
font-weight: 500;
text-transform: uppercase;
font-size: 0.875rem;
font-size: 1rem;
opacity: 0.75;
${({ isButton, theme }) =>
isButton
? LargePillButtonStyle
Expand All @@ -42,7 +43,7 @@ export const Wrapper = styled.div<{ isButton: boolean }>`
${Rate} {
font-family: ${fontMono};
font-size: 0.875rem;
font-size: 1rem;
font-weight: 500;
}
`};
Expand Down
3 changes: 1 addition & 2 deletions src/components/Dropdown/Dropdown.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const ButtonStyle = css`
justify-content: space-between;
position: relative;
border: 1px solid ${({ theme }) => theme.colors.borderGrey};
border-inline-start: unset;
width: 100%;
height: var(--dropdown-button-height);
padding: 0 0.75rem;
Expand Down Expand Up @@ -165,7 +164,7 @@ export const NativeSelect = styled.select`
export const Wrapper = styled.div`
position: relative;
--dropdown-button-height: 3.75rem;
--dropdown-button-height: 3rem;
--dropdown-options-wrapper-padding: 0.5rem;
${NativeSelectWrapper} {
Expand Down
5 changes: 5 additions & 0 deletions src/components/SettingsPopover/SettingsPopover.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ export const ThemeButton = styled.button<ButtonStyleProps>`
: props.theme.colors.darkSubText};
background-color: ${(props) =>
props.$isActive ? props.theme.colors.borderGrey : "transparent"};
&:disabled {
pointer-events: none;
opacity: 0.5;
}
`;

type LocaleContainerType = {
Expand Down
1 change: 1 addition & 0 deletions src/components/SettingsPopover/SettingsPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const SettingsPopover = ({
{t("common.system")}
</ThemeButton>
<ThemeButton
disabled
$isActive={selectedTheme === "light"}
onClick={() => handleThemeButtonClick("light")}
>
Expand Down
21 changes: 10 additions & 11 deletions src/components/TokenSelect/TokenSelect.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,22 @@ export const MaxButtonStyle = css`
position: relative;
bottom: 1px;
align-self: center;
border-radius: 0.125rem;
font-family: Verdana, sans-serif;
font-weight: 600;
border-radius: 0.25rem;
font-family: ${fontWide};
font-weight: 500;
font-size: 0.75rem;
line-height: 1;
background-color: ${(props) => props.theme.colors.lightGrey};
color: ${(props) => props.theme.colors.black};
opacity: 0.6;
padding: 0.25rem 0.5rem;
background-color: ${(props) => props.theme.colors.darkBlue};
color: ${(props) => props.theme.colors.lightGrey};
opacity: 1;
${BorderlessButtonStyle}
&:hover,
&:focus {
background-color: ${(props) => props.theme.colors.white};
background-color: ${(props) => props.theme.colors.primary};
color: ${(props) => props.theme.colors.white};
opacity: 1;
}
`;
Expand All @@ -112,10 +114,7 @@ export const MaxButton = styled.button`
${MaxButtonStyle};
width: ${() => (isActiveLanguageLogographic() ? "1.75rem" : "auto")};
padding: 0.125rem;
text-transform: uppercase;
letter-spacing: ${() => (isActiveLanguageLogographic() ? 0 : "0.0625rem")};
font-size: ${() => (isActiveLanguageLogographic() ? "0.75rem" : "0.5rem")};
font-size: ${() => (isActiveLanguageLogographic() ? "0.75rem" : "0.6875rem")};
`;

export const InfoLabel = styled.div`
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/useSystemTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const useSystemTheme = () => {
};
}, []);

return systemTheme;
// TOOD: Enable when light mode is ready
return "dark" as ThemeType;
// return systemTheme;
};

export default useSystemTheme;
2 changes: 1 addition & 1 deletion src/style/sizes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const sizes = {
toolbarMaxHeight: "44rem",
tradeContainerPadding: "3.75rem",
tradeContainerMobilePadding: "2rem",
widgetSize: "34rem",
widgetSize: "37.5rem",
widgetMobileSize: "24rem",
};
4 changes: 2 additions & 2 deletions src/styled-components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const SelectElementStyle = css`

export const SelectWrapper = styled.div`
display: flex;
height: 3.75rem;
height: 3rem;
width: fit-content;
color: ${({ theme }) =>
theme.name === "dark" ? theme.colors.white : theme.colors.primary};
Expand All @@ -31,7 +31,7 @@ export const SelectLabel = styled.div`
border-top-left-radius: 0.75rem;
border-bottom-left-radius: 0.75rem;
border-inline-end: unset;
padding-inline: 1.25rem 0.25rem;
padding-inline: 0.5rem;
color: ${({ theme }) => theme.colors.lightGrey};
background: ${({ theme }) => theme.colors.darkGrey};
Expand Down

0 comments on commit 68384c3

Please sign in to comment.