Skip to content

Commit

Permalink
feat: add some styling
Browse files Browse the repository at this point in the history
  • Loading branch information
kovipu committed Aug 19, 2024
1 parent 64b649f commit b47ddab
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 25 deletions.
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"@astrojs/react": "^3.6.0",
"@astrojs/tailwind": "^5.1.0",
"@creit.tech/stellar-wallets-kit": "^0.9.2",
"@fontsource/inter": "^5.0.20",
"@stellar/freighter-api": "^2.0.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
Expand All @@ -25,7 +26,7 @@
"scripts": {
"astro": "astro",
"build": "astro check && astro build",
"dev": "npm run init && astro dev",
"dev": "astro dev",
"init": "node initialize.js",
"preview": "astro preview",
"start": "npm run init && astro dev",
Expand Down
15 changes: 15 additions & 0 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { PropsWithChildren } from "react";

export const SelectButtonWrapper = ({ children }: PropsWithChildren) => (
<div className="flex bg-grey p-1 gap-2 rounded-full">{children}</div>
)

export interface SelectLinkButtonProps {
href: string;
selected: boolean;
}

export const SelectLinkButton = ({ href, selected, children }: PropsWithChildren<SelectLinkButtonProps>) => (
<a className={`text-white font-bold px-6 py-1.5 rounded-full ${selected ? 'bg-white text-black' : ''}`} href={href}>{children}</a>
)

17 changes: 11 additions & 6 deletions src/components/Nav.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import logo from '/public/laina_v3_shrinked.png';
import { SelectButtonWrapper, SelectLinkButton } from './Button';

export default function Nav() {
interface NavProps {
pathname: 'index' | 'lend' | 'borrow' | 'liquidate';
}

export default function Nav({ pathname }: NavProps) {
return (
<nav className="relative max-w-screen-lg mx-auto mb-12 flex justify-between items-center pt-12 pb-6">
<div>
Expand All @@ -9,11 +14,11 @@ export default function Nav() {
</a>
</div>

<div className="flex gap-12 bg-gray-200 rounded-full px-8 py-2 text-white font-bold">
<a href="/lend">Lend</a>
<a href="/borrow">Borrow</a>
<a href="/liquidate">Liquidate</a>
</div>
<SelectButtonWrapper>
<SelectLinkButton href="/lend" selected={pathname === 'lend'}>Lend</SelectLinkButton>
<SelectLinkButton href="/borrow" selected={pathname === 'borrow'}>Borrow</SelectLinkButton>
<SelectLinkButton href="/liquidate" selected={pathname === 'liquidate'}>Liquidate</SelectLinkButton>
</SelectButtonWrapper>

<div className="bg-black text-white px-8 py-2 rounded-full">
{/* biome-ignore lint: TODO: connect wallet */}
Expand Down
12 changes: 4 additions & 8 deletions src/components/lending.astro
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<div class="flex w-[700px] h-[90px] mx-auto">
<h1>Lend Assets</h1>
</div>

<div class="flex shadow-xl bg-white w-[700px] h-[90px] mx-auto my-2 rounded-2xl px-5 py-3 justify-between">
<div class="flex shadow-xl bg-white w-full my-2 rounded-2xl px-5 py-3 justify-between">
<div class="flex w-[55px] items-center justify-center">
<img src="/Stellar_Symbol.png" alt="Stellar lumens logo" width="50" />
</div>

<div class="w-[120px]">
<div>
<strong> Stellar Lumens</strong>
<p>XLM</p>
</div>

<div class="w-[110px]">
<div>
<p>Total supplied</p>
<strong id="current-liquid" aria-live="polite">???</strong>
<p>$30.82</p>
Expand All @@ -27,7 +23,7 @@
<button xlm-withdraw aria-controls="current">Withdraw</button>
</div>

<div class="relative flex shadow-xl bg-white w-[700px] h-[90px] mx-auto my-2 rounded-2xl px-5 py-3 justify-between">
<div class="relative flex shadow-xl bg-white w-full my-2 rounded-2xl px-5 py-3 justify-between">
<div class="flex w-[55px] items-center justify-center">
<img src="/usdc.svg" alt="USD Coin logo" />
</div>
Expand Down
17 changes: 12 additions & 5 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
---
import '@fontsource/inter';
import '@fontsource/inter/600.css';
import Nav from '../components/Nav';
interface Props {
title: string;
pathname: 'index' | 'lend' | 'borrow' | 'liquidate';
}
const { title } = Astro.props;
import Nav from '../components/Nav';
const { title, pathname } = Astro.props;
---

<!doctype html>
Expand All @@ -17,9 +22,11 @@ import Nav from '../components/Nav';
<meta name="generator" content={Astro.generator} />
<title>{title}</title>
</head>
<body>
<Nav />
<slot />
<body class="font-sans bg-grey-light min-h-screen">
<Nav pathname={pathname} />
<main class="max-w-full w-256">
<slot />
</main>
</body>
</html>
<style is:global>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/borrow.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Loan_pool from '../components/borrowing.astro';
import Layout from '../layouts/Layout.astro';
---

<Layout title="Laina – Borrowing">
<Layout title="Laina – Borrowing" pathname="borrow">
<ConnectFreighter />
<Loan_pool />
</Layout>
2 changes: 1 addition & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Layout from '../layouts/Layout.astro';
---

<Layout title="Laina - DeFi made simple.">
<Layout title="Laina - DeFi made simple." pathname="index">
<main>
<div>
<h1>Landing page</h1>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/lend.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import Loan_pool from '../components/lending.astro';
import Layout from '../layouts/Layout.astro';
---

<Layout title="Laina – Lending">
<Layout title="Laina – Lending" pathname="lend">
<ConnectFreighter />
<h1 class="text-5xl font-bold mb-8">Lend Assets</h1>

<Loan_pool />
</Layout>
2 changes: 1 addition & 1 deletion src/pages/liquidate.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Layout from '../layouts/Layout.astro';
---

<Layout title="Laina – DeFi made simple">
<Layout title="Laina – DeFi made simple" pathname="liquidate">
<main>
<div>
<h1>Liquidate page</h1>
Expand Down
18 changes: 17 additions & 1 deletion tailwind.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@
export default {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
theme: {
extend: {},
fontFamily: {
sans: ['Inter', 'system-ui', 'sans-serif'],
},
colors: {
white: '#fff',
grey: {
DEFAULT: '#999',
light: '#efefef',
},
black: '#000',
},
extend: {
spacing: {
128: '32rem',
256: '64rem',
},
},
},
plugins: [],
};

0 comments on commit b47ddab

Please sign in to comment.