-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from terra-money/fix/icons-styling
fix: icons and styling
- Loading branch information
Showing
10 changed files
with
172 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
import React, { ForwardedRef, forwardRef } from 'react'; | ||
import { ReactComponent as Dashboard } from "styles/images/icons/Dashboard.svg"; | ||
import HeaderIconButton from "app/components/HeaderIconButton"; | ||
import { STATION } from "config/constants"; | ||
import { DashboardIcon, Tooltip } from "@terra-money/station-ui" | ||
import { useTranslation } from "react-i18next" | ||
import { STATION } from "config/constants" | ||
|
||
const DashboardButton = forwardRef((_, ref: ForwardedRef<HTMLButtonElement>) => { | ||
const openDashboard = () => window.open(STATION, "_blank"); | ||
return ( | ||
<HeaderIconButton onClick={openDashboard} ref={ref}> | ||
<Dashboard style={{ height: 18, color: "var(--token-dark-900)" }} /> | ||
</HeaderIconButton> | ||
); | ||
}); | ||
const DashboardButton = () => { | ||
const openDashboard = () => window.open(STATION, "_blank") | ||
const { t } = useTranslation() | ||
|
||
export default DashboardButton; | ||
return ( | ||
<Tooltip | ||
content={t("Dashboard")} | ||
children={ | ||
<DashboardIcon | ||
width={18} | ||
height={18} | ||
onClick={openDashboard} | ||
style={{ | ||
cursor: "pointer", | ||
margin: "24px 12px 16px 16px", | ||
}} | ||
fill={"var(--token-dark-900)"} | ||
/> | ||
} | ||
/> | ||
) | ||
} | ||
|
||
export default DashboardButton |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { SettingsIcon } from "@terra-money/station-ui" | ||
import { useNavigate } from "react-router-dom" | ||
|
||
const SettingsButton = () => { | ||
const navigate = useNavigate() | ||
|
||
return ( | ||
<SettingsIcon | ||
width={18} | ||
height={18} | ||
onClick={() => navigate("/preferences")} | ||
style={{ | ||
cursor: "pointer", | ||
marginTop: "24px", | ||
marginBottom: "16px", | ||
}} | ||
fill={"var(--token-dark-900)"} | ||
/> | ||
) | ||
} | ||
|
||
export default SettingsButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,82 @@ | ||
import { useAuth } from "auth"; | ||
import { bech32 } from "bech32"; | ||
import is from "auth/scripts/is"; | ||
import styles from "./ManageWalletsButton.module.scss"; | ||
// icons | ||
import { ReactComponent as WalletIcon } from "styles/images/icons/Wallet.svg"; | ||
import UsbIcon from "@mui/icons-material/Usb"; | ||
import BluetoothIcon from "@mui/icons-material/Bluetooth"; | ||
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { forwardRef, ForwardedRef } from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import { | ||
DropdownArrowIcon, | ||
LedgerIcon, | ||
WalletIcon, | ||
} from "@terra-money/station-ui" | ||
import BluetoothIcon from "@mui/icons-material/Bluetooth" | ||
import styles from "./ManageWalletsButton.module.scss" | ||
import { forwardRef, ForwardedRef } from "react" | ||
import { useTranslation } from "react-i18next" | ||
import { useNavigate } from "react-router-dom" | ||
import is from "auth/scripts/is" | ||
import { bech32 } from "bech32" | ||
import { useAuth } from "auth" | ||
|
||
const ManageWalletsButton = forwardRef((_, ref: ForwardedRef<HTMLButtonElement>) => { | ||
const navigate = useNavigate(); | ||
const { wallet, wallets } = useAuth(); | ||
const { t } = useTranslation(); | ||
const ManageWalletsButton = forwardRef( | ||
(_, ref: ForwardedRef<HTMLButtonElement>) => { | ||
const navigate = useNavigate() | ||
const { wallet, wallets } = useAuth() | ||
const { t } = useTranslation() | ||
|
||
const selectedWallet = wallets.find((w) => { | ||
if ("words" in w) { | ||
return w.words["330"] === wallet?.words["330"]; | ||
} else { | ||
const selectedWallet = wallets.find((w) => { | ||
if ("words" in w) { | ||
return w.words["330"] === wallet?.words["330"] | ||
} else { | ||
return ( | ||
Buffer.from(bech32.decode(w.address).words).toString("hex") === | ||
wallet?.words["330"] | ||
) | ||
} | ||
}) | ||
|
||
const isLedger = is.ledger(wallet) | ||
|
||
if (!selectedWallet && !isLedger) { | ||
return ( | ||
Buffer.from(bech32.decode(w.address).words).toString("hex") === | ||
wallet?.words["330"] | ||
); | ||
<button | ||
className={styles.manage__wallets} | ||
onClick={() => navigate("/")} | ||
ref={ref} | ||
> | ||
<WalletIcon width={18} height={18} fill={"var(--token-dark-900)"} />{" "} | ||
{t("Connect wallet")} | ||
</button> | ||
) | ||
} | ||
}); | ||
|
||
const isLedger = is.ledger(wallet); | ||
|
||
if (!selectedWallet && !isLedger) { | ||
return ( | ||
<button className={styles.manage__wallets} onClick={() => navigate("/")} ref={ref}> | ||
<WalletIcon style={{ fontSize: 18 }} /> {t("Connect wallet")} | ||
<button | ||
className={styles.manage__wallets} | ||
style={{ margin: "24px 0px 16px 2px" }} | ||
data-testid="manage-wallets-button" | ||
onClick={() => navigate("/manage-wallet/select")} | ||
ref={ref} | ||
> | ||
{isLedger ? ( | ||
wallet.bluetooth ? ( | ||
<BluetoothIcon | ||
style={{ fontSize: "18px", color: "var(--token-dark-900)" }} | ||
/> | ||
) : ( | ||
<LedgerIcon width={18} height={18} fill={"var(--token-dark-900)"} /> | ||
) | ||
) : ( | ||
<WalletIcon width={18} height={18} fill={"var(--token-dark-900)"} /> | ||
)}{" "} | ||
<div className={styles.selector}> | ||
<span>{wallet && "name" in wallet ? wallet.name : "Ledger"}</span> | ||
<DropdownArrowIcon | ||
style={{ | ||
marginLeft: "8px", | ||
}} | ||
fill={"var(--token-dark-900)"} | ||
width={13} | ||
height={13} | ||
/> | ||
</div> | ||
</button> | ||
); | ||
) | ||
} | ||
) | ||
|
||
return ( | ||
<button | ||
className={styles.manage__wallets} | ||
data-testid="manage-wallets-button" | ||
onClick={() => navigate("/manage-wallet/select")} | ||
ref={ref} | ||
> | ||
{isLedger ? ( | ||
wallet.bluetooth ? ( | ||
<BluetoothIcon style={{ fontSize: 18 }} /> | ||
) : ( | ||
<UsbIcon style={{ fontSize: 18 }} /> | ||
) | ||
) : ( | ||
<WalletIcon style={{ fontSize: 18 }} /> | ||
)}{" "} | ||
<div className={styles.selector}> | ||
<span>{wallet && "name" in wallet ? wallet.name : "Ledger"}</span> | ||
<ArrowDropDownIcon /> | ||
</div> | ||
</button> | ||
); | ||
}); | ||
|
||
export default ManageWalletsButton; | ||
export default ManageWalletsButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.