Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
b50e5511
Unverified
Commit
b50e5511
authored
Mar 07, 2022
by
Zach Pomerantz
Committed by
GitHub
Mar 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update loading colors (#3438)
* chore: update loading colors * fix: loading opacity of 0.6
parent
1efe5e9c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
17 deletions
+43
-17
inline_spinner.svg
src/lib/assets/svg/inline_spinner.svg
+1
-0
Input.tsx
src/lib/components/Swap/Input.tsx
+3
-3
Output.tsx
src/lib/components/Swap/Output.tsx
+1
-1
TokenInput.tsx
src/lib/components/Swap/TokenInput.tsx
+4
-4
Caption.tsx
src/lib/components/Swap/Toolbar/Caption.tsx
+17
-2
loading.ts
src/lib/css/loading.ts
+10
-4
index.tsx
src/lib/icons/index.tsx
+7
-3
No files found.
src/lib/assets/svg/inline_spinner.svg
View file @
b50e5511
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
stroke=
"none"
stroke=
"none"
/>
/>
<circle
<circle
id=
"track"
cx=
"12"
cx=
"12"
cy=
"12"
cy=
"12"
r=
"10"
r=
"10"
...
...
src/lib/components/Swap/Input.tsx
View file @
b50e5511
import
{
useLingui
}
from
'
@lingui/react
'
import
{
useLingui
}
from
'
@lingui/react
'
import
{
Currency
,
CurrencyAmount
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
CurrencyAmount
}
from
'
@uniswap/sdk-core
'
import
{
useUSDCValue
}
from
'
hooks/useUSDCPrice
'
import
{
useUSDCValue
}
from
'
hooks/useUSDCPrice
'
import
{
loading
Opacity
Css
}
from
'
lib/css/loading
'
import
{
loading
Transition
Css
}
from
'
lib/css/loading
'
import
{
import
{
useIsSwapFieldIndependent
,
useIsSwapFieldIndependent
,
useSwapAmount
,
useSwapAmount
,
...
@@ -23,7 +23,7 @@ import TokenImg from '../TokenImg'
...
@@ -23,7 +23,7 @@ import TokenImg from '../TokenImg'
import
TokenInput
from
'
./TokenInput
'
import
TokenInput
from
'
./TokenInput
'
export
const
USDC
=
styled
(
Row
)
`
export
const
USDC
=
styled
(
Row
)
`
${
loading
Opacity
Css
}
;
${
loading
Transition
Css
}
;
`
`
export
const
Balance
=
styled
(
ThemedText
.
Body2
)
<
{
focused
:
boolean
}
>
`
export
const
Balance
=
styled
(
ThemedText
.
Body2
)
<
{
focused
:
boolean
}
>
`
...
@@ -122,7 +122,7 @@ export default function Input({ disabled, focused }: InputProps) {
...
@@ -122,7 +122,7 @@ export default function Input({ disabled, focused }: InputProps) {
>
>
<
ThemedText
.
Body2
color=
"secondary"
userSelect
>
<
ThemedText
.
Body2
color=
"secondary"
userSelect
>
<
Row
>
<
Row
>
<
USDC
$loading=
{
is
Loading
}
>
{
inputUSDC
?
`$${inputUSDC.toFixed(2)}`
:
'
-
'
}
</
USDC
>
<
USDC
isLoading=
{
isRoute
Loading
}
>
{
inputUSDC
?
`$${inputUSDC.toFixed(2)}`
:
'
-
'
}
</
USDC
>
{
balance
&&
(
{
balance
&&
(
<
Balance
color=
{
balanceColor
}
focused=
{
focused
}
>
<
Balance
color=
{
balanceColor
}
focused=
{
focused
}
>
Balance:
<
span
>
{
formatCurrencyAmount
(
balance
,
4
,
i18n
.
locale
)
}
</
span
>
Balance:
<
span
>
{
formatCurrencyAmount
(
balance
,
4
,
i18n
.
locale
)
}
</
span
>
...
...
src/lib/components/Swap/Output.tsx
View file @
b50e5511
...
@@ -102,7 +102,7 @@ export default function Output({ disabled, focused, children }: PropsWithChildre
...
@@ -102,7 +102,7 @@ export default function Output({ disabled, focused, children }: PropsWithChildre
>
>
<
ThemedText
.
Body2
color=
"secondary"
userSelect
>
<
ThemedText
.
Body2
color=
"secondary"
userSelect
>
<
Row
>
<
Row
>
<
USDC
gap=
{
0.5
}
$loading=
{
is
Loading
}
>
<
USDC
gap=
{
0.5
}
isLoading=
{
isRoute
Loading
}
>
{
outputUSDC
?
`$${outputUSDC.toFixed(2)}`
:
'
-
'
}
{
priceImpact
}
{
outputUSDC
?
`$${outputUSDC.toFixed(2)}`
:
'
-
'
}
{
priceImpact
}
</
USDC
>
</
USDC
>
{
balance
&&
(
{
balance
&&
(
...
...
src/lib/components/Swap/TokenInput.tsx
View file @
b50e5511
...
@@ -2,7 +2,7 @@ import 'setimmediate'
...
@@ -2,7 +2,7 @@ import 'setimmediate'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Currency
}
from
'
@uniswap/sdk-core
'
import
{
Currency
}
from
'
@uniswap/sdk-core
'
import
{
loading
Opacity
Css
}
from
'
lib/css/loading
'
import
{
loading
Transition
Css
}
from
'
lib/css/loading
'
import
styled
,
{
keyframes
,
ThemedText
}
from
'
lib/theme
'
import
styled
,
{
keyframes
,
ThemedText
}
from
'
lib/theme
'
import
{
ReactNode
,
useCallback
,
useEffect
,
useMemo
,
useRef
,
useState
}
from
'
react
'
import
{
ReactNode
,
useCallback
,
useEffect
,
useMemo
,
useRef
,
useState
}
from
'
react
'
...
@@ -16,7 +16,7 @@ const TokenInputRow = styled(Row)`
...
@@ -16,7 +16,7 @@ const TokenInputRow = styled(Row)`
grid-template-columns: 1fr;
grid-template-columns: 1fr;
`
`
const
ValueInput
=
styled
(
DecimalInput
)
<
{
$loading
:
boolean
}
>
`
const
ValueInput
=
styled
(
DecimalInput
)
`
color:
${({
theme
})
=>
theme
.
primary
}
;
color:
${({
theme
})
=>
theme
.
primary
}
;
height: 1em;
height: 1em;
...
@@ -28,7 +28,7 @@ const ValueInput = styled(DecimalInput)<{ $loading: boolean }>`
...
@@ -28,7 +28,7 @@ const ValueInput = styled(DecimalInput)<{ $loading: boolean }>`
color:
${({
theme
})
=>
theme
.
onHover
(
theme
.
secondary
)}
;
color:
${({
theme
})
=>
theme
.
onHover
(
theme
.
secondary
)}
;
}
}
${
loading
Opacity
Css
}
${
loading
Transition
Css
}
`
`
const
delayedFadeIn
=
keyframes
`
const
delayedFadeIn
=
keyframes
`
...
@@ -108,7 +108,7 @@ export default function TokenInput({
...
@@ -108,7 +108,7 @@ export default function TokenInput({
onFocus=
{
()
=>
setShowMax
(
hasMax
)
}
onFocus=
{
()
=>
setShowMax
(
hasMax
)
}
onChange=
{
onChangeInput
}
onChange=
{
onChangeInput
}
disabled=
{
disabled
||
!
currency
}
disabled=
{
disabled
||
!
currency
}
$l
oading=
{
Boolean
(
loading
)
}
isL
oading=
{
Boolean
(
loading
)
}
ref=
{
input
}
ref=
{
input
}
></
ValueInput
>
></
ValueInput
>
</
ThemedText
.
H2
>
</
ThemedText
.
H2
>
...
...
src/lib/components/Swap/Toolbar/Caption.tsx
View file @
b50e5511
...
@@ -2,9 +2,10 @@ import { Trans } from '@lingui/macro'
...
@@ -2,9 +2,10 @@ import { Trans } from '@lingui/macro'
import
{
Currency
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
useUSDCPrice
from
'
hooks/useUSDCPrice
'
import
useUSDCPrice
from
'
hooks/useUSDCPrice
'
import
Tooltip
from
'
lib/components/Tooltip
'
import
Tooltip
from
'
lib/components/Tooltip
'
import
{
loadingCss
}
from
'
lib/css/loading
'
import
{
WrapType
}
from
'
lib/hooks/swap/useWrapCallback
'
import
{
WrapType
}
from
'
lib/hooks/swap/useWrapCallback
'
import
{
AlertTriangle
,
Icon
,
Info
,
InlineSpinner
}
from
'
lib/icons
'
import
{
AlertTriangle
,
Icon
,
Info
,
InlineSpinner
}
from
'
lib/icons
'
import
{
ThemedText
}
from
'
lib/theme
'
import
styled
,
{
ThemedText
}
from
'
lib/theme
'
import
{
ReactNode
,
useCallback
,
useMemo
,
useState
}
from
'
react
'
import
{
ReactNode
,
useCallback
,
useMemo
,
useState
}
from
'
react
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
...
@@ -12,6 +13,11 @@ import { TextButton } from '../../Button'
...
@@ -12,6 +13,11 @@ import { TextButton } from '../../Button'
import
Row
from
'
../../Row
'
import
Row
from
'
../../Row
'
import
RoutingDiagram
from
'
../RoutingDiagram
'
import
RoutingDiagram
from
'
../RoutingDiagram
'
const
Loading
=
styled
.
span
`
color:
${({
theme
})
=>
theme
.
secondary
}
;
${
loadingCss
}
;
`
interface
CaptionProps
{
interface
CaptionProps
{
icon
?:
Icon
icon
?:
Icon
caption
:
ReactNode
caption
:
ReactNode
...
@@ -47,7 +53,16 @@ export function Empty() {
...
@@ -47,7 +53,16 @@ export function Empty() {
}
}
export
function
LoadingTrade
()
{
export
function
LoadingTrade
()
{
return
<
Caption
icon=
{
InlineSpinner
}
caption=
{
<
Trans
>
Fetching best price…
</
Trans
>
}
/>
return
(
<
Caption
icon=
{
InlineSpinner
}
caption=
{
<
Loading
>
<
Trans
>
Fetching best price…
</
Trans
>
</
Loading
>
}
/>
)
}
}
export
function
WrapCurrency
({
loading
,
wrapType
}:
{
loading
:
boolean
;
wrapType
:
WrapType
.
UNWRAP
|
WrapType
.
WRAP
})
{
export
function
WrapCurrency
({
loading
,
wrapType
}:
{
loading
:
boolean
;
wrapType
:
WrapType
.
UNWRAP
|
WrapType
.
WRAP
})
{
...
...
src/lib/css/loading.ts
View file @
b50e5511
import
{
css
}
from
'
lib/theme
'
import
{
css
}
from
'
lib/theme
'
// need to use $loading as `loading` is a reserved prop
export
const
loadingOpacity
=
0.6
export
const
loadingOpacityCss
=
css
<
{
$loading
:
boolean
}
>
`
filter:
${({
$loading
})
=>
(
$loading
?
'
grayscale(1)
'
:
'
none
'
)}
;
export
const
loadingCss
=
css
`
opacity:
${({
$loading
})
=>
(
$loading
?
'
0.4
'
:
'
1
'
)}
;
filter: grayscale(1);
opacity:
${
loadingOpacity
}
;
`
// need to use isLoading as `loading` is a reserved prop
export
const
loadingTransitionCss
=
css
<
{
isLoading
:
boolean
}
>
`
${({
isLoading
})
=>
isLoading
&&
loadingCss
}
;
transition: opacity 0.2s ease-in-out;
transition: opacity 0.2s ease-in-out;
`
`
src/lib/icons/index.tsx
View file @
b50e5511
...
@@ -6,6 +6,7 @@ import { ReactComponent as InlineSpinnerIcon } from 'lib/assets/svg/inline_spinn
...
@@ -6,6 +6,7 @@ import { ReactComponent as InlineSpinnerIcon } from 'lib/assets/svg/inline_spinn
import
{
ReactComponent
as
LogoIcon
}
from
'
lib/assets/svg/logo.svg
'
import
{
ReactComponent
as
LogoIcon
}
from
'
lib/assets/svg/logo.svg
'
import
{
ReactComponent
as
SpinnerIcon
}
from
'
lib/assets/svg/spinner.svg
'
import
{
ReactComponent
as
SpinnerIcon
}
from
'
lib/assets/svg/spinner.svg
'
import
{
ReactComponent
as
WalletIcon
}
from
'
lib/assets/svg/wallet.svg
'
import
{
ReactComponent
as
WalletIcon
}
from
'
lib/assets/svg/wallet.svg
'
import
{
loadingCss
}
from
'
lib/css/loading
'
import
styled
,
{
Color
,
css
,
keyframes
}
from
'
lib/theme
'
import
styled
,
{
Color
,
css
,
keyframes
}
from
'
lib/theme
'
import
{
FunctionComponent
,
SVGProps
}
from
'
react
'
import
{
FunctionComponent
,
SVGProps
}
from
'
react
'
/* eslint-disable no-restricted-imports */
/* eslint-disable no-restricted-imports */
...
@@ -146,7 +147,10 @@ export const Spinner = styled(icon(SpinnerIcon))<{ color?: Color }>`
...
@@ -146,7 +147,10 @@ export const Spinner = styled(icon(SpinnerIcon))<{ color?: Color }>`
export
const
InlineSpinner
=
styled
(
icon
(
InlineSpinnerIcon
))
<
{
color
?:
Color
}
>
`
export
const
InlineSpinner
=
styled
(
icon
(
InlineSpinnerIcon
))
<
{
color
?:
Color
}
>
`
animation:
${
rotate
}
1s cubic-bezier(0.83, 0, 0.17, 1) infinite;
animation:
${
rotate
}
1s cubic-bezier(0.83, 0, 0.17, 1) infinite;
color:
${({
color
=
'
active
'
,
theme
})
=>
theme
[
color
]}
;
color:
${({
color
=
'
active
'
,
theme
})
=>
theme
[
color
]}
;
fill:
${({
theme
})
=>
theme
.
outline
}
;
fill:
${({
color
=
'
active
'
,
theme
})
=>
theme
[
color
]}
;
stroke:
${({
theme
})
=>
theme
.
outline
}
;
stroke-linecap: round;
#track {
stroke:
${({
theme
})
=>
theme
.
secondary
}
;
${
loadingCss
}
;
}
`
`
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment