Skip to content

Commit

Permalink
App: split LoanScreen into components (#384)
Browse files Browse the repository at this point in the history
LoanScreen panel components:

- PanelUpdateBorrowPosition
- PanelUpdateLeveragePosition
- PanelUpdateRate
- PanelClosePosition

App UI Components:

- InfoBox
- WarningBox
- InputTokenBadge
- ValueUpdate
  • Loading branch information
bpierre authored Aug 28, 2024
1 parent 38dcb34 commit e9905ab
Show file tree
Hide file tree
Showing 9 changed files with 1,353 additions and 1,252 deletions.
30 changes: 30 additions & 0 deletions frontend/app/src/comps/InfoBox/InfoBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { ReactNode } from "react";

import { css } from "@/styled-system/css";

export function InfoBox({
children,
gap = 16,
}: {
children: ReactNode;
gap?: number;
}) {
return (
<div
className={css({
display: "flex",
flexDirection: "column",
padding: 16,
fontSize: 16,
background: "infoSurface",
border: "1px solid token(colors.infoSurfaceBorder)",
borderRadius: 8,
})}
style={{
gap,
}}
>
{children}
</div>
);
}
37 changes: 37 additions & 0 deletions frontend/app/src/comps/InputTokenBadge/InputTokenBadge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { ReactNode } from "react";

import { css } from "@/styled-system/css";

export function InputTokenBadge({
background = true,
icon,
label,
}: {
background?: boolean;
icon?: ReactNode;
label: ReactNode;
}) {
return (
<div
className={css({
display: "flex",
alignItems: "center",
gap: 8,
height: 40,
fontSize: 24,
userSelect: "none",
})}
style={{
paddingLeft: icon ? 8 : 16,
background: background ? "#FFF" : "transparent",
borderRadius: background ? 20 : 0,
padding: background ? "0 16px" : 0,
}}
>
{icon}
<div>
{label}
</div>
</div>
);
}
32 changes: 32 additions & 0 deletions frontend/app/src/comps/ValueUpdate/ValueUpdate.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { ReactNode } from "react";

import { css } from "@/styled-system/css";
import { HFlex } from "@liquity2/uikit";

const ARROW_RIGHT = "→";

export function ValueUpdate({
after,
before,
fontSize = 16,
tabularNums = true,
}: {
after: ReactNode;
before: ReactNode;
fontSize?: number;
tabularNums?: boolean;
}) {
return (
<HFlex
gap={8}
style={{
fontSize,
fontVariantNumeric: tabularNums ? "tabular-nums" : "inherit",
}}
>
<div className={css({ color: "contentAlt" })}>{before}</div>
<div className={css({ color: "contentAlt" })}>{ARROW_RIGHT}</div>
<div>{after}</div>
</HFlex>
);
}
26 changes: 26 additions & 0 deletions frontend/app/src/comps/WarningBox/WarningBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { ReactNode } from "react";

import { css } from "@/styled-system/css";

export function WarningBox({
children,
}: {
children: ReactNode;
}) {
return (
<div
className={css({
display: "flex",
flexDirection: "column",
gap: 16,
padding: 16,
fontSize: 16,
color: "negativeContent",
background: "negativeStrong",
borderRadius: 8,
})}
>
{children}
</div>
);
}
Loading

0 comments on commit e9905ab

Please sign in to comment.