mirror of
https://github.com/kremalicious/asi-calculator.git
synced 2024-12-22 09:23:16 +01:00
form refactor
This commit is contained in:
parent
fd7bbe224a
commit
dfbf7bb55a
@ -3,6 +3,6 @@
|
|||||||
border: 1px solid rgba(var(--foreground-rgb), 0.15);
|
border: 1px solid rgba(var(--foreground-rgb), 0.15);
|
||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin: -0.15em 0.25rem 0 0.25rem;
|
margin-top: -0.15em;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
5
components/FormInline/FormInline.tsx
Normal file
5
components/FormInline/FormInline.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import styles from './FormInline.module.css'
|
||||||
|
|
||||||
|
export function FormInline({ children }: { children: React.ReactNode }) {
|
||||||
|
return <form className={styles.form}>{children}</form>
|
||||||
|
}
|
1
components/FormInline/index.tsx
Normal file
1
components/FormInline/index.tsx
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './FormInline'
|
@ -6,20 +6,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.input:hover {
|
.input:hover {
|
||||||
background-color: rgba(var(--background-rgb), 0.5);
|
background-color: rgba(var(--background-rgb), 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.input:focus-within {
|
.input:focus-within {
|
||||||
outline: none;
|
outline: none;
|
||||||
background-color: rgba(var(--background-rgb), 0.9);
|
background-color: rgba(var(--background-rgb), 0.3);
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
.input:hover {
|
|
||||||
background-color: rgba(var(--foreground-rgb), 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.input:focus-within {
|
|
||||||
background-color: rgba(var(--foreground-rgb), 0.2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,22 +9,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.select:hover:not(.select[disabled]) {
|
.select:hover:not(.select[disabled]) {
|
||||||
background-color: rgba(var(--background-rgb), 0.5);
|
background-color: rgba(var(--background-rgb), 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.select:focus-within {
|
.select:focus-within {
|
||||||
outline: none;
|
outline: none;
|
||||||
background-color: rgba(var(--background-rgb), 0.9);
|
background-color: rgba(var(--background-rgb), 0.3);
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
.select:hover:not(.select[disabled]) {
|
|
||||||
background-color: rgba(var(--foreground-rgb), 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.select:focus-within {
|
|
||||||
background-color: rgba(var(--foreground-rgb), 0.2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
export * from './Content'
|
export * from './Content'
|
||||||
export * from './Footer'
|
export * from './Footer'
|
||||||
|
export * from './FormInline'
|
||||||
export * from './Header'
|
export * from './Header'
|
||||||
export * from './Input'
|
export * from './Input'
|
||||||
export * from './Label'
|
export * from './Label'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
The **→ lines** show what you would get with the displayed token amount at the moment of the ASI swap, along with the converted value based on the current market price of FET.
|
The **→ lines** show what you would get with the displayed token amount at the moment of the ASI swap, along with the converted value based on the current market price of FET.
|
||||||
|
|
||||||
The fiat values are fetched from [Coingecko](https://coingecko.com), and the token swap estimations directly from [Uniswap](https://uniswap.org) v3 swap routes.
|
The fiat values are fetched from [Coingecko](https://coingecko.com) and used to calculate the _All Markets_ scenario. The token swap estimations for Uniswap are fetched directly from [Uniswap](https://uniswap.org) v3 swap routes.
|
||||||
|
|
||||||
All displayed values should be seen as estimates. Except for the [fixed ASI exchange rate](https://blog.oceanprotocol.com/ocean-protocol-is-joining-the-superintelligence-alliance-767c82693f24#3c8e), all other values are constantly changing based on market conditions. There is no guarantee the displayed values reflect the value of your investment once the actual ASI swap mechanism is released. Use at your own risk.
|
All displayed values should be seen as estimates. Except for the [fixed ASI exchange rate](https://blog.oceanprotocol.com/ocean-protocol-is-joining-the-superintelligence-alliance-767c82693f24#3c8e), all other values are constantly changing based on market conditions. There is no guarantee the displayed values reflect the value of your investment once the actual ASI swap mechanism is released. Use at your own risk.
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import styles from './FormAmount.module.css'
|
|
||||||
import { Dispatch, SetStateAction } from 'react'
|
import { Dispatch, SetStateAction } from 'react'
|
||||||
import { TokenSymbol } from '@/types'
|
import { TokenSymbol } from '@/types'
|
||||||
import { Select, Input } from '@/components'
|
import { Select, Input, FormInline } from '@/components'
|
||||||
|
|
||||||
export function FormAmount({
|
export function FormAmount({
|
||||||
amount,
|
amount,
|
||||||
@ -40,7 +39,7 @@ export function FormAmount({
|
|||||||
]
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form className={styles.form}>
|
<FormInline>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
inputMode="numeric"
|
inputMode="numeric"
|
||||||
@ -59,6 +58,6 @@ export function FormAmount({
|
|||||||
disabled={!setToken}
|
disabled={!setToken}
|
||||||
style={setToken ? { paddingRight: '1.25rem' } : {}}
|
style={setToken ? { paddingRight: '1.25rem' } : {}}
|
||||||
/>
|
/>
|
||||||
</form>
|
</FormInline>
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -1 +0,0 @@
|
|||||||
export * from './FormAmount'
|
|
@ -1,6 +1,5 @@
|
|||||||
import styles from './FormMarket.module.css'
|
|
||||||
import { Dispatch, SetStateAction } from 'react'
|
import { Dispatch, SetStateAction } from 'react'
|
||||||
import { Select } from '@/components'
|
import { Select, FormInline } from '@/components'
|
||||||
import { type Market } from '@/features/strategies'
|
import { type Market } from '@/features/strategies'
|
||||||
|
|
||||||
export function FormMarket({
|
export function FormMarket({
|
||||||
@ -15,13 +14,13 @@ export function FormMarket({
|
|||||||
{ value: 'uniswap-v3', label: 'Uniswap v3' }
|
{ value: 'uniswap-v3', label: 'Uniswap v3' }
|
||||||
]
|
]
|
||||||
return (
|
return (
|
||||||
<form className={styles.form}>
|
<FormInline>
|
||||||
<Select
|
<Select
|
||||||
options={options}
|
options={options}
|
||||||
value={market}
|
value={market}
|
||||||
onChange={(e) => setMarket(e.target.value as Market)}
|
onChange={(e) => setMarket(e.target.value as Market)}
|
||||||
style={{ paddingRight: '1.25rem' }}
|
style={{ paddingRight: '1.25rem' }}
|
||||||
/>
|
/>
|
||||||
</form>
|
</FormInline>
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -1,8 +0,0 @@
|
|||||||
.form {
|
|
||||||
display: inline-flex;
|
|
||||||
border: 1px solid rgba(var(--foreground-rgb), 0.15);
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
overflow: hidden;
|
|
||||||
margin: -0.15em 0.25rem 0 0.25rem;
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
export * from './FormMarket'
|
|
@ -1,3 +1,5 @@
|
|||||||
export * from './FormAmount'
|
export * from './FormAmount'
|
||||||
export * from './FormMarket'
|
export * from './FormMarket'
|
||||||
export * from './Result'
|
export * from './Result'
|
||||||
|
export * from './Buy'
|
||||||
|
export * from './Swap'
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
export * from './components/Buy'
|
export * from './components'
|
||||||
export * from './components/Swap'
|
|
||||||
export * from './hooks'
|
export * from './hooks'
|
||||||
export * from './types'
|
export * from './types'
|
||||||
|
Loading…
Reference in New Issue
Block a user