mirror of
https://github.com/kremalicious/blog.git
synced 2025-02-14 21:10:25 +01:00
loading state, logo fallback state
This commit is contained in:
parent
f181ac444d
commit
15130e8d92
src
components/Sponsor/Web3Donation/components
Input
Tokens
pages
styles
@ -69,6 +69,11 @@
|
|||||||
composes: message from '../../index.module.css';
|
composes: message from '../../index.module.css';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disclaimer {
|
||||||
|
font-size: var(--font-size-mini);
|
||||||
|
color: var(--text-color-light);
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
from {
|
from {
|
||||||
opacity: 0.01;
|
opacity: 0.01;
|
||||||
|
@ -3,6 +3,7 @@ import Input from '@components/Input'
|
|||||||
import { Conversion } from '../Conversion'
|
import { Conversion } from '../Conversion'
|
||||||
import styles from './InputGroup.module.css'
|
import styles from './InputGroup.module.css'
|
||||||
import { TokenSelect } from '../Tokens'
|
import { TokenSelect } from '../Tokens'
|
||||||
|
import config from '@config/blog.config'
|
||||||
|
|
||||||
export function InputGroup({
|
export function InputGroup({
|
||||||
amount,
|
amount,
|
||||||
@ -41,6 +42,9 @@ export function InputGroup({
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<Conversion amount={amount} symbol={symbol} />
|
<Conversion amount={amount} symbol={symbol} />
|
||||||
|
<div className={styles.disclaimer}>
|
||||||
|
This form sends tokens to my account <code>{config.author.ether}</code>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -21,14 +21,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.TokenLogo {
|
.TokenLogo {
|
||||||
display: block;
|
width: 34px;
|
||||||
width: 32px;
|
height: 34px;
|
||||||
height: 32px;
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
margin-right: calc(var(--spacer) / 4);
|
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;
|
overflow: hidden;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: var(--font-size-mini);
|
||||||
}
|
}
|
||||||
|
|
||||||
.TokenLogo img {
|
.TokenLogo img {
|
||||||
|
@ -33,7 +33,11 @@ export const Token = forwardRef<HTMLDivElement, SelectItemProps>(
|
|||||||
>
|
>
|
||||||
<Select.ItemText>
|
<Select.ItemText>
|
||||||
<span className="TokenLogo">
|
<span className="TokenLogo">
|
||||||
<img src={token.logo || ''} width="32" height="32" />
|
{token.logo ? (
|
||||||
|
<img src={token.logo} width="32" height="32" />
|
||||||
|
) : (
|
||||||
|
token.symbol?.substring(0, 3)
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
</Select.ItemText>
|
</Select.ItemText>
|
||||||
<div>
|
<div>
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
.loader {
|
||||||
|
--borderWidth: 10px;
|
||||||
|
--dashes: 10;
|
||||||
|
--gap: 10deg;
|
||||||
|
--color: var(--text-color);
|
||||||
|
|
||||||
|
width: 100px;
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 1px;
|
||||||
|
background: conic-gradient(#0000, var(--color)) content-box;
|
||||||
|
|
||||||
|
--_m: repeating-conic-gradient(
|
||||||
|
#0000 0deg,
|
||||||
|
#000 1deg calc(360deg / var(--dashes) - var(--gap) - 1deg),
|
||||||
|
#0000 calc(360deg / var(--dashes) - var(--gap))
|
||||||
|
calc(360deg / var(--dashes))
|
||||||
|
),
|
||||||
|
radial-gradient(
|
||||||
|
farthest-side,
|
||||||
|
#0000 calc(98% - var(--borderWidth)),
|
||||||
|
#000 calc(100% - var(--borderWidth))
|
||||||
|
);
|
||||||
|
|
||||||
|
/* stylelint-disable-next-line property-no-vendor-prefix */
|
||||||
|
-webkit-mask: var(--_m);
|
||||||
|
mask: var(--_m);
|
||||||
|
/* stylelint-disable-next-line property-no-vendor-prefix */
|
||||||
|
-webkit-mask-composite: destination-in;
|
||||||
|
mask-composite: intersect;
|
||||||
|
animation: load 1s infinite steps(var(--dashes));
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes load {
|
||||||
|
to {
|
||||||
|
transform: rotate(1turn);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
import './TokenLoading.css'
|
||||||
|
|
||||||
|
export function TokenLoading() {
|
||||||
|
return (
|
||||||
|
<div className="TokenLogo TokenLoading">
|
||||||
|
<span className="loader"></span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
@ -1,8 +1,3 @@
|
|||||||
/* reset */
|
|
||||||
button {
|
|
||||||
all: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
.SelectTrigger {
|
.SelectTrigger {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -3,13 +3,14 @@ import './TokenSelect.css'
|
|||||||
import { Token } from './Token'
|
import { Token } from './Token'
|
||||||
import { ChevronDown, ChevronsDown, ChevronsUp } from '@images/components/react'
|
import { ChevronDown, ChevronsDown, ChevronsUp } from '@images/components/react'
|
||||||
import { useTokens } from '../../hooks/useTokens'
|
import { useTokens } from '../../hooks/useTokens'
|
||||||
|
import { TokenLoading } from './TokenLoading'
|
||||||
|
|
||||||
export function TokenSelect({
|
export function TokenSelect({
|
||||||
setToken
|
setToken
|
||||||
}: {
|
}: {
|
||||||
setToken: (token: string) => void
|
setToken: (token: string) => void
|
||||||
}) {
|
}) {
|
||||||
const { data: tokens } = useTokens()
|
const { data: tokens, isLoading } = useTokens()
|
||||||
|
|
||||||
const items = tokens?.map((token) => (
|
const items = tokens?.map((token) => (
|
||||||
<Token key={token.address} token={token} />
|
<Token key={token.address} token={token} />
|
||||||
@ -17,12 +18,16 @@ export function TokenSelect({
|
|||||||
|
|
||||||
return tokens ? (
|
return tokens ? (
|
||||||
<Select.Root
|
<Select.Root
|
||||||
defaultValue={tokens[0].address}
|
defaultValue={tokens?.[0].address}
|
||||||
onValueChange={(value) => setToken(value)}
|
onValueChange={(value) => setToken(value)}
|
||||||
disabled={!tokens}
|
disabled={!tokens || isLoading}
|
||||||
>
|
>
|
||||||
<Select.Trigger className="SelectTrigger" aria-label="Token">
|
<Select.Trigger
|
||||||
<Select.Value />
|
className="SelectTrigger"
|
||||||
|
disabled={!tokens || isLoading}
|
||||||
|
aria-label="Token"
|
||||||
|
>
|
||||||
|
{isLoading ? <TokenLoading /> : <Select.Value />}
|
||||||
<Select.Icon>
|
<Select.Icon>
|
||||||
<ChevronDown />
|
<ChevronDown />
|
||||||
</Select.Icon>
|
</Select.Icon>
|
||||||
|
@ -37,12 +37,12 @@ const coins = Object.entries(config.author).filter(
|
|||||||
<BackButton />
|
<BackButton />
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h3 class="subTitle">Send ERC-20 tokens from your browser wallet.</h3>
|
<h3 class="subTitle">Send from your browser wallet.</h3>
|
||||||
<Web3 client:only="react" />
|
<Web3 client:only="react" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h3 class="subTitle">Send Bitcoin or ERC-20 tokens from any wallet.</h3>
|
<h3 class="subTitle">Send from any wallet.</h3>
|
||||||
|
|
||||||
{
|
{
|
||||||
coins.map(([key, value]: [key: string, value: string]) => (
|
coins.map(([key, value]: [key: string, value: string]) => (
|
||||||
|
@ -56,6 +56,7 @@ textarea {
|
|||||||
|
|
||||||
/* Reset default button element */
|
/* Reset default button element */
|
||||||
button {
|
button {
|
||||||
|
all: unset;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
Loading…
Reference in New Issue
Block a user