Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: style progress bar #2844

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,30 @@ export const CurrencyAmountWrapper = styled.div`
gap: 2px;
`

export const ProgressBarWrapper = styled.div`
width: 100%;
max-width: 50%;
align-items: center;
flex-flow: row nowrap;
gap: 8px;
flex-direction: row-reverse;
padding: 0 0;
font-size: 12px;
font-weight: 500;
height: 100%;
display: flex;
text-align: left;
background: transparent;
justify-content: center;

> b {
line-height: 1;
}
`

export const ProgressBar = styled.div<{ value: number }>`
position: relative;
margin: 2px 0 0;
margin: 0;
height: 5px;
width: 100%;
background: ${({ theme }) => (theme.darkMode ? theme.bg1 : transparentize(0.92, theme.text1))};
Expand Down
7 changes: 6 additions & 1 deletion src/modules/ordersTable/pure/ReceiptModal/FilledField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Code based on https://github.com/cowprotocol/explorer/blob/develop/src/components/orders/FilledProgress/index.tsx

import { ProgressBarWrapper, ProgressBar } from 'modules/ordersTable/pure/OrdersTableContainer/OrderRow/styled'

import { TokenAmount } from 'common/pure/TokenAmount'
import { getFilledAmounts } from 'utils/orderUtils/getFilledAmounts'
import { ParsedOrder } from 'utils/orderUtils/parseOrder'
Expand All @@ -21,7 +23,10 @@ export function FilledField({ order }: Props) {
return (
<styledEl.Value>
<styledEl.InlineWrapper>
<styledEl.Progress active={filledPercentDisplay || 0} />
<ProgressBarWrapper>
<b>{filledPercentDisplay}%</b>
<ProgressBar value={filledPercentDisplay || 0}></ProgressBar>
</ProgressBarWrapper>
</styledEl.InlineWrapper>

<styledEl.InlineWrapper>
Expand Down
27 changes: 1 addition & 26 deletions src/modules/ordersTable/pure/ReceiptModal/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,38 +147,13 @@ export const Value = styled.div`
font-weight: 500;
`

export const Progress = styled.div<{ active: number | string }>`
--height: 4px;
display: flex;
align-items: center;
gap: 6px;
position: relative;
height: var(--height);
width: 150px;

&::before {
display: inline-block;
content: '';
height: 100%;
width: 100%;
border-radius: var(--height);
background: ${({ theme, active }) =>
`linear-gradient(90deg, ${theme.success} ${active}%, ${theme.bg3} ${active}%)`};
}

&::after {
display: inline-block;
content: '${({ active }) => `${active}%`}';
color: ${({ theme }) => theme.success};
}
`

export const InlineWrapper = styled.div`
display: flex;
flex-flow: row wrap;
align-items: center;
justify-content: flex-end;
gap: 6px;
width: 100%;
`

export const Surplus = styled.span`
Expand Down
Loading