Skip to content

Commit

Permalink
update SwapWidget styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mikestarrdev committed Nov 29, 2024
1 parent 015a530 commit e509402
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 32 deletions.
10 changes: 6 additions & 4 deletions packages/site/src/components/RadixSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import * as Select from '@radix-ui/react-select';
import styled from 'styled-components';

const StyledTrigger = styled(Select.Trigger)`
width: 100%;
font-size: 12px;
background: transparent;
color: white;
border: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
`;

const StyledContent = styled(Select.Content)`
Expand All @@ -19,6 +16,10 @@ const StyledContent = styled(Select.Content)`
border: solid #34425c 1px;
border-radius: 10px;
padding: 1rem;
&:hover {
border: solid #34425c 1px;
}
`;

const StyledItem = styled(Select.Item)`
Expand All @@ -27,6 +28,7 @@ const StyledItem = styled(Select.Item)`
cursor: pointer;
&:hover {
background-color: #21396a;
// border: solid 1px #34425c;
}
`;

Expand Down
57 changes: 32 additions & 25 deletions packages/site/src/pages/SwapWidget/SwapWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import {
HorizontalFlexBox,
InputWrapper,
SelectLabel,

Check failure on line 20 in packages/site/src/pages/SwapWidget/SwapWidget.tsx

View workflow job for this annotation

GitHub Actions / Build, lint, and test / Lint

'SelectLabel' is defined but never used
SelectLabelExpiresIn,
SelectLabelFor,
SelectWrapper,
} from './SwapWidgetStyles';

const hoursItems = [
Expand Down Expand Up @@ -51,28 +54,30 @@ export const SwapWidget = () => {
{/* wrapper around 'for' and 'expires in' containers */}
<HorizontalFlexBox>
<ForContainer>
<SelectLabel>For</SelectLabel>
<RadixSelect
ariaLabel="for"
placeholder="anyone"
value={takerType}
items={takerItems}
onSelectChange={(value: string) => {
// Handle `anyone` or `0x...` address
if (value === 'anyone' || value.startsWith('0x')) {
setTakerType(value as TakerTypeValues);
if (value === 'anyone') {
setTakerAddress(undefined); // Clear taker address for `anyone`
<SelectLabelFor>For</SelectLabelFor>
<SelectWrapper>
<RadixSelect
ariaLabel="for"
placeholder="anyone"
value={takerType}
items={takerItems}
onSelectChange={(value: string) => {
// Handle `anyone` or `0x...` address
if (value === 'anyone' || value.startsWith('0x')) {
setTakerType(value as TakerTypeValues);
if (value === 'anyone') {
setTakerAddress(undefined); // Clear taker address for `anyone`
}
}
}
}}
/>
}}
/>
</SelectWrapper>
</ForContainer>

{/* duration container */}
<ExpiryContainer>
<HeaderInputContainer>
<SelectLabel>Expires In</SelectLabel>
<SelectLabelExpiresIn>Expires In</SelectLabelExpiresIn>
<DurationContainer>
<NumberInput
placeholder="1"
Expand All @@ -84,15 +89,17 @@ export const SwapWidget = () => {
}}
/>
</DurationContainer>
<RadixSelect
ariaLabel="hours"
placeholder="HOURS"
value={durationUnits}
items={hoursItems}
onSelectChange={(value: string) =>
setDurationUnits(value as DurationUnits)
}
/>
<SelectWrapper>
<RadixSelect
ariaLabel="hours"
placeholder="HOURS"
value={durationUnits}
items={hoursItems}
onSelectChange={(value: string) =>
setDurationUnits(value as DurationUnits)
}
/>
</SelectWrapper>
</HeaderInputContainer>
</ExpiryContainer>
</HorizontalFlexBox>
Expand Down
20 changes: 17 additions & 3 deletions packages/site/src/pages/SwapWidget/SwapWidgetStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,31 @@ export const HeaderInputContainer = styled.div`
border-radius: 10px;
`;

export const SelectLabel = styled.span`
export const SelectLabelFor = styled.span`
display: flex;
flex-direction: row;
padding: 1rem;
color: #798bad;
padding-left: 2rem;
padding-right: 2rem;
`;

export const SelectLabelExpiresIn = styled.span`
display: flex;
flex-direction: row;
padding-left: 2rem;
padding-right: 2rem;
color: #798bad;
border-right: solid #34425c 1px;
`;

export const DurationContainer = styled.div`
display: flex;
`;

export const SelectWrapper = styled.div`
border-left: solid #34425c 1px;
padding: 1rem;
justify-self: center;
border: solid #34425c 1px;
`;

export const InputWrapper = styled.div<InputWrapperProps>`
Expand Down

0 comments on commit e509402

Please sign in to comment.