mirror of
https://github.com/kremalicious/blog.git
synced 2025-02-14 21:10:25 +01:00
styling
This commit is contained in:
parent
ea9ed0382e
commit
f181ac444d
@ -6,6 +6,10 @@ export type GetToken = {
|
|||||||
symbol: string | null
|
symbol: string | null
|
||||||
decimals: number | null
|
decimals: number | null
|
||||||
logo: string | null
|
logo: string | null
|
||||||
|
price: {
|
||||||
|
usd: number | null
|
||||||
|
eur: number | null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getTokens(
|
export async function getTokens(
|
||||||
|
@ -28,6 +28,7 @@ export function InputGroup({
|
|||||||
inputMode="decimal"
|
inputMode="decimal"
|
||||||
pattern="[0-9.]*"
|
pattern="[0-9.]*"
|
||||||
value={amount}
|
value={amount}
|
||||||
|
placeholder="0.00"
|
||||||
onChange={(e) => setAmount(e.target.value)}
|
onChange={(e) => setAmount(e.target.value)}
|
||||||
className={styles.inputInput}
|
className={styles.inputInput}
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.SelectItem {
|
.Token {
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
@ -10,40 +10,29 @@
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.SelectItem[data-disabled] {
|
.Token[data-disabled] {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.SelectItem[data-highlighted] {
|
.Token[data-highlighted] {
|
||||||
outline: none;
|
outline: none;
|
||||||
background-color: var(--text-color);
|
background-color: var(--box-background-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.SelectItem[data-highlighted],
|
.TokenLogo {
|
||||||
.SelectItem[data-highlighted] * {
|
display: block;
|
||||||
color: var(--body-background-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.SelectItem,
|
|
||||||
.Token {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.Token {
|
|
||||||
min-width: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.Token img {
|
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
margin: 0;
|
|
||||||
margin-right: calc(var(--spacer) / 4);
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
margin-right: calc(var(--spacer) / 4);
|
||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
background: var(--brand-light);
|
background: var(--brand-light);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.TokenLogo img {
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.TokenName,
|
.TokenName,
|
||||||
@ -58,7 +47,14 @@
|
|||||||
|
|
||||||
.TokenBalance {
|
.TokenBalance {
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
font-variant: tabular-nums;
|
}
|
||||||
|
|
||||||
|
.TokenValue {
|
||||||
|
font-size: var(--font-size-small);
|
||||||
|
display: inline-flex;
|
||||||
|
align-self: flex-start;
|
||||||
|
margin-left: auto;
|
||||||
|
padding-left: calc(var(--spacer) * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.SelectItemIndicator {
|
.SelectItemIndicator {
|
||||||
|
@ -19,23 +19,29 @@ export const Token = forwardRef<HTMLDivElement, SelectItemProps>(
|
|||||||
})
|
})
|
||||||
: 0
|
: 0
|
||||||
|
|
||||||
return balance && parseInt(balance) !== 0 ? (
|
const valueInUsd =
|
||||||
|
token.balance && token.price?.usd ? token.balance * token.price.usd : 0
|
||||||
|
const valueInUsdFormatted = formatCurrency(valueInUsd, 'USD', 'en')
|
||||||
|
|
||||||
|
return balance && parseInt(balance) !== 0 && valueInUsd >= 1 ? (
|
||||||
<Select.Item
|
<Select.Item
|
||||||
className={`${className} SelectItem`}
|
className={`${className ? className : ''} Token`}
|
||||||
{...props}
|
{...props}
|
||||||
value={token.address}
|
value={token.address}
|
||||||
title={token.address}
|
title={token.address}
|
||||||
ref={forwardedRef}
|
ref={forwardedRef}
|
||||||
>
|
>
|
||||||
<div className="Token">
|
<Select.ItemText>
|
||||||
<Select.ItemText>
|
<span className="TokenLogo">
|
||||||
<img src={token.logo || ''} width="32" height="32" />
|
<img src={token.logo || ''} width="32" height="32" />
|
||||||
</Select.ItemText>
|
</span>
|
||||||
<div>
|
</Select.ItemText>
|
||||||
<h3 className="TokenName">{token.name}</h3>
|
<div>
|
||||||
<p className="TokenBalance">{balance}</p>
|
<h3 className="TokenName">{token.name}</h3>
|
||||||
</div>
|
<p className="TokenBalance">{balance}</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="TokenValue">{valueInUsdFormatted}</div>
|
||||||
|
|
||||||
<Select.ItemIndicator className="SelectItemIndicator">
|
<Select.ItemIndicator className="SelectItemIndicator">
|
||||||
<Check />
|
<Check />
|
||||||
</Select.ItemIndicator>
|
</Select.ItemIndicator>
|
||||||
|
@ -16,8 +16,7 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.SelectTrigger:hover {
|
.SelectTrigger:hover {
|
||||||
background-color: var(--text-color);
|
background-color: var(--box-background-color);
|
||||||
color: var(--body-background-color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* .SelectTrigger:focus {
|
/* .SelectTrigger:focus {
|
||||||
@ -29,13 +28,8 @@ button {
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.SelectTrigger img {
|
.SelectTrigger .TokenLogo {
|
||||||
width: 32px;
|
margin-right: calc(var(--spacer) / 12);
|
||||||
height: 32px;
|
|
||||||
margin: 0;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 1px solid var(--border-color);
|
|
||||||
background: var(--brand-light);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.SelectContent {
|
.SelectContent {
|
||||||
|
@ -19,9 +19,10 @@ export function TokenSelect({
|
|||||||
<Select.Root
|
<Select.Root
|
||||||
defaultValue={tokens[0].address}
|
defaultValue={tokens[0].address}
|
||||||
onValueChange={(value) => setToken(value)}
|
onValueChange={(value) => setToken(value)}
|
||||||
|
disabled={!tokens}
|
||||||
>
|
>
|
||||||
<Select.Trigger className="SelectTrigger" aria-label="Token">
|
<Select.Trigger className="SelectTrigger" aria-label="Token">
|
||||||
<Select.Value placeholder="…" />
|
<Select.Value />
|
||||||
<Select.Icon>
|
<Select.Icon>
|
||||||
<ChevronDown />
|
<ChevronDown />
|
||||||
</Select.Icon>
|
</Select.Icon>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import { useAccount, useNetwork } from 'wagmi'
|
import { useAccount, useNetwork } from 'wagmi'
|
||||||
import { getTokens, type GetTokens } from '../api/getTokens'
|
import { getTokens, type GetToken } from '../api/getTokens'
|
||||||
|
|
||||||
export function useTokens() {
|
export function useTokens() {
|
||||||
const { address } = useAccount()
|
const { address } = useAccount()
|
||||||
const { chain } = useNetwork()
|
const { chain } = useNetwork()
|
||||||
|
|
||||||
const [data, setData] = useState<GetTokens[]>()
|
const [data, setData] = useState<GetToken[]>()
|
||||||
const [isLoading, setIsLoading] = useState<boolean>()
|
const [isLoading, setIsLoading] = useState<boolean>()
|
||||||
const [isError, setIsError] = useState<boolean>()
|
const [isError, setIsError] = useState<boolean>()
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ export default function Web3Donation({
|
|||||||
const { address: account } = useAccount()
|
const { address: account } = useAccount()
|
||||||
const { chain } = useNetwork()
|
const { chain } = useNetwork()
|
||||||
|
|
||||||
const [amount, setAmount] = useState('0.005')
|
const [amount, setAmount] = useState('')
|
||||||
const [debouncedAmount] = useDebounce(amount, 500)
|
const [debouncedAmount] = useDebounce(amount, 500)
|
||||||
const [token, setToken] = useState<string>()
|
const [token, setToken] = useState<string>()
|
||||||
const [message, setMessage] = useState<{ status: string; text: string }>()
|
const [message, setMessage] = useState<{ status: string; text: string }>()
|
||||||
|
@ -33,24 +33,24 @@ export const theme = {
|
|||||||
colors: {
|
colors: {
|
||||||
accentColor: 'var(--brand-cyan)',
|
accentColor: 'var(--brand-cyan)',
|
||||||
accentColorForeground: '#161a1b',
|
accentColorForeground: '#161a1b',
|
||||||
actionButtonBorder: 'var(--body-background-color)',
|
actionButtonBorder: 'var(--border-color)',
|
||||||
actionButtonBorderMobile: 'var(--body-background-color)',
|
actionButtonBorderMobile: 'var(--border-color)',
|
||||||
actionButtonSecondaryBackground: 'var(--box-background-color)',
|
actionButtonSecondaryBackground: 'var(--box-background-color)',
|
||||||
closeButton: 'var(--text-color)',
|
closeButton: 'var(--text-color)',
|
||||||
closeButtonBackground: 'var(--box-background-color)',
|
closeButtonBackground: 'var(--box-background-color)',
|
||||||
connectButtonBackground: 'var(--body-background-color)',
|
connectButtonBackground: 'var(--body-background-color)',
|
||||||
connectButtonBackgroundError: 'var(--alert-error)',
|
connectButtonBackgroundError: 'var(--alert-error)',
|
||||||
connectButtonInnerBackground: 'var(--box-background-color)',
|
connectButtonInnerBackground: 'var(--body-background-color)',
|
||||||
connectButtonText: 'var(--text-color)',
|
connectButtonText: 'var(--text-color)',
|
||||||
connectButtonTextError: '#161a1b',
|
connectButtonTextError: '#161a1b',
|
||||||
connectionIndicator: 'var(--alert-success)',
|
connectionIndicator: 'var(--alert-success)',
|
||||||
error: 'var(--alert-error)',
|
error: 'var(--alert-error)',
|
||||||
generalBorder: 'var(--border-color)',
|
generalBorder: 'var(--border-color)',
|
||||||
generalBorderDim: 'var(--border-color)',
|
generalBorderDim: 'var(--border-color)',
|
||||||
menuItemBackground: 'var(--link-color)',
|
menuItemBackground: 'var(--border-color)',
|
||||||
modalBackdrop: 'rgba(0, 0, 0, 0.5)',
|
modalBackdrop: 'rgba(0, 0, 0, 0.5)',
|
||||||
modalBackground: 'var(--body-background-color)',
|
modalBackground: 'var(--body-background-color)',
|
||||||
modalBorder: 'var(--body-background-color)',
|
modalBorder: 'var(--border-color)',
|
||||||
modalText: 'var(--text-color)',
|
modalText: 'var(--text-color)',
|
||||||
modalTextDim: 'var(--text-color-dimmed)',
|
modalTextDim: 'var(--text-color-dimmed)',
|
||||||
modalTextSecondary: 'var(--text-color-light)',
|
modalTextSecondary: 'var(--text-color-light)',
|
||||||
@ -71,11 +71,11 @@ export const theme = {
|
|||||||
modalMobile: 'var(--border-radius)'
|
modalMobile: 'var(--border-radius)'
|
||||||
},
|
},
|
||||||
shadows: {
|
shadows: {
|
||||||
connectButton: 'var(--box-shadow)',
|
connectButton: 'none',
|
||||||
dialog: 'var(--box-shadow)',
|
dialog: 'var(--box-shadow)',
|
||||||
profileDetailsAction: 'none',
|
profileDetailsAction: 'none',
|
||||||
selectedOption: 'var(--box-shadow)',
|
selectedOption: 'none',
|
||||||
selectedWallet: 'var(--box-shadow)',
|
selectedWallet: 'none',
|
||||||
walletLogo: 'var(--box-shadow)'
|
walletLogo: 'var(--box-shadow)'
|
||||||
}
|
}
|
||||||
} as Theme
|
} as Theme
|
||||||
|
@ -37,7 +37,7 @@ const coins = Object.entries(config.author).filter(
|
|||||||
<BackButton />
|
<BackButton />
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h3 class="subTitle">Send ETH from your browser wallet.</h3>
|
<h3 class="subTitle">Send ERC-20 tokens from your browser wallet.</h3>
|
||||||
<Web3 client:only="react" />
|
<Web3 client:only="react" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user