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/stake gateway2.5 updates #1006

Merged
merged 14 commits into from
Jul 12, 2023
Merged
31 changes: 31 additions & 0 deletions packages/boba/gateway/src/components/dao/LinearProgress/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'
import { ProgressBar, Line, Circle, Label, LabelContainer } from './style'
import { LinearProgressProps } from './types'

export const LinearProgress: React.FC<LinearProgressProps> = ({ A, B, C }) => {
const totalWidth = A + B + C
const forWidth = `${(A / totalWidth) * 100}%`
const againstWidth = `${(B / totalWidth) * 100}%`
const abstainWidth = `${(C / totalWidth) * 100}%`

return (
<>
<ProgressBar className="progress-bar">
<Line className="for" style={{ width: forWidth }} />
<Line className="against" style={{ width: againstWidth }} />
<Line className="abstain" style={{ width: abstainWidth }} />
</ProgressBar>
<LabelContainer>
<Label>
<Circle className="for" /> For: {A}
</Label>
<Label>
<Circle className="against" /> Against: {B}{' '}
</Label>
<Label>
<Circle className="abstain" /> Abstain: {C}
</Label>
</LabelContainer>
</>
)
}
45 changes: 45 additions & 0 deletions packages/boba/gateway/src/components/dao/LinearProgress/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import styled from 'styled-components'

export const ProgressBar = styled.div`
display: flex;
`
export const Line = styled.div`
height: 6px;
&.for {
background: ${(props) => props.theme.colors.green[300]};
}
&.against {
background: rgba(255, 106, 85, 1);
}
&.abstain {
background: ${(props) => props.theme.colors.gray[300]};
}
`

export const Circle = styled.span`
display: inline-flex;
width: 8px;
height: 8px;
margin-right: 5px;
border-radius: 50%;
&.for {
background: ${(props) => props.theme.colors.green[300]};
}
&.against {
background: rgba(255, 106, 85, 1);
}
&.abstain {
background: ${(props) => props.theme.colors.gray[300]};
}
`

export const LabelContainer = styled.div`
display: flex;
padding: 10px 0px;
gap: 0px 25px;
`

export const Label = styled.p`
font-weight: 400;
font-size: ${(props) => props.theme.text.body2};
`
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface LinearProgressProps {
A: number
B: number
C: number
}
6 changes: 6 additions & 0 deletions packages/boba/gateway/src/components/dao/label/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react'
import { LabelContainer } from './styles'

export const Label = (props: { status: string }) => {
return <LabelContainer state={props.status}>{props.status}</LabelContainer>
}
32 changes: 32 additions & 0 deletions packages/boba/gateway/src/components/dao/label/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import styled, { css } from 'styled-components'

export const LabelContainer = styled.div<{ state: string }>`
display: flex;
margin-left: auto;
font-size: ${(props) => props.theme.text.body3};
border-radius: 6px;
color: ${(props) => props.theme.colors.red[300]};
border: 1px solid ${(props) => props.theme.colors.red[300]};
padding: 4px 8px;

${(props) =>
props.state === 'Active' &&
css`
color: ${props.theme.colors.green[300]};
border-color: ${props.theme.colors.green[300]};
`}

${(props) =>
props.state === 'Pending' &&
css`
color: rgba(247, 195, 103, 1);
border-color: rgba(247, 195, 103, 1);
`}

${(props) =>
props.state === 'Canceled' &&
css`
color: ${props.theme.colors.gray[100]};
border-color: ${props.theme.colors.gray[100]};
`}
`
26 changes: 26 additions & 0 deletions packages/boba/gateway/src/components/dao/preloader/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react'
import {
PreloaderContainer,
Preload,
Number,
Title,
Label,
Arrow,
} from './styles'

export const Preloader = () => {
const limit = 4

return (
<PreloaderContainer>
{Array.from({ length: limit }).map((_, index) => (
<Preload key={index}>
<Number />
<Title />
<Label />
<Arrow />
</Preload>
))}
</PreloaderContainer>
)
}
50 changes: 50 additions & 0 deletions packages/boba/gateway/src/components/dao/preloader/styles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import styled, { css, keyframes } from 'styled-components'

const pulseAnimation = keyframes`
0% {
background-color: rgba(255,255,255,0.1);
}
100% {
background-color: rgba(255,255,255,0.2);
}
`
const BasePreloader = styled.div`
height: 22px;
background: rgba(255, 255, 255, 0.2);
animation: ${css`
${pulseAnimation} 0.65s infinite alternate
`};

width: 100%;
`
export const Number = styled(BasePreloader)`
width: 25px;
`
export const Title = styled(BasePreloader)`
width: 100%;
`
export const Label = styled(BasePreloader)`
width: 70px;
`
export const Arrow = styled(BasePreloader)`
width: 12px;
`

export const PreloaderContainer = styled.div`
width: 100%;
gap: 15px 0px;
padding-right: 15px;
display: flex;
flex-direction: column;
`
export const Preload = styled.div`
border: 1px solid ${(props) => props.theme.colors.box.border};
border-radius: 12px;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
gap: 0px 10px;
padding: 20px;
background: ${(props) => props.theme.colors.box.background};
`
12 changes: 8 additions & 4 deletions packages/boba/gateway/src/components/global/background/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const gradientColor = (theme: string) => {
if (theme === 'light') {
return 'radial-gradient(45% 45% at 50% 50%, rgba(174, 219, 1, 0.4) 19.79%, rgba(174, 219, 1, 0.125) 50%, rgba(174, 219, 1, 0) 70%);'
} else {
return 'radial-gradient(45% 45% at 50% 50%, rgba(174, 219, 1, 0.32) 19.79%, rgba(174, 219, 1, 0.1) 50%, rgba(174, 219, 1, 0) 70%);'
return 'radial-gradient(55.87% 55.87% at 50.00% 50.00%, rgba(174, 219, 1, 0.24) 19.79%, rgba(174, 219, 1, 0.08) 62.50%, rgba(174, 219, 1, 0.00) 91.67%);'
}
}

Expand All @@ -37,10 +37,14 @@ export const GridBackground = styled.div`
export const GridFade = styled.div<BackgroundProps>`
width: 100%;
height: 100%;
max-width: 1441px;
max-height: 870px;
position: absolute;
z-index: 1;
transform: translateY(-50vh);
will-change: translateY;
left: 50%;
top: 50%;
transform: translate(-50%, -100%);
will-change: translate;
transition: transform 1s ease;
background-image: ${(props) => gradientColor(props.theme.name)};
background-clip: padding-box;
Expand All @@ -49,7 +53,7 @@ export const GridFade = styled.div<BackgroundProps>`
${({ position }) =>
position === 'top' &&
`
transform: translateY(-100vh);
transform:translate(-50%, -150%);
`}
`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Button Default Button 1`] = `
<DocumentFragment>
<button
class="sc-bgqQcB iScuhT"
class="sc-bgqQcB dtFbmO"
type="button"
>
Test Button
Expand All @@ -14,7 +14,7 @@ exports[`Button Default Button 1`] = `
exports[`Button Disable Button 1`] = `
<DocumentFragment>
<button
class="sc-bgqQcB kJERur"
class="sc-bgqQcB ggCAzm"
type="button"
>
Test Button
Expand All @@ -25,7 +25,7 @@ exports[`Button Disable Button 1`] = `
exports[`Button Loading Button 1`] = `
<DocumentFragment>
<button
class="sc-bgqQcB ebQeRa"
class="sc-bgqQcB rbfxr"
type="button"
>
<span
Expand All @@ -36,10 +36,21 @@ exports[`Button Loading Button 1`] = `
</DocumentFragment>
`;

exports[`Button Outline Button 1`] = `
<DocumentFragment>
<button
class="sc-bgqQcB beNNKZ"
type="button"
>
Outline Button
</button>
</DocumentFragment>
`;

exports[`Button Small Button 1`] = `
<DocumentFragment>
<button
class="sc-bgqQcB eyNniH"
class="sc-bgqQcB hWWaYy"
type="button"
>
Test Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@ Small.args = {
small: true,
label: 'Default Button',
}

export const Outline = Template.bind({})
Outline.args = {
disable: false,
loading: false,
small: false,
outline: true,
label: 'Default Button',
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,11 @@ describe('Button', () => {
})
expect(asFragment()).toMatchSnapshot()
})
test('Outline Button', () => {
const { asFragment } = renderButton({
outline: true,
label: 'Outline Button',
})
expect(asFragment()).toMatchSnapshot()
})
})
6 changes: 6 additions & 0 deletions packages/boba/gateway/src/components/global/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export const Button: FC<ButtonTypes> = ({
disable = false,
loading = false,
small = false,
outline = false,
transparent = false,
className,
label,
onClick,
}) => {
Expand All @@ -15,7 +18,10 @@ export const Button: FC<ButtonTypes> = ({
disable={disable}
loading={loading}
onClick={onClick}
outline={outline}
transparent={transparent}
small={small}
className={className}
>
{loading && <SpinLoader />} {label}
</ButtonContainer>
Expand Down
Loading
Loading