Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): consistent button styles #656

Merged
merged 18 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
964dbc9
fix(ui): consistent button styles in WalletCreationForm
theborakompanioni Sep 9, 2023
057f284
fix(ui): consistent button styles in WalletCreationConfirmation
theborakompanioni Sep 9, 2023
c9520b0
fix(ui): consistent button styles in Create/Import Wallet
theborakompanioni Sep 9, 2023
4722fff
fix(ui): consistent button styles on Wallet List
theborakompanioni Sep 9, 2023
10722f4
fix(ui): consistent button text when submitting on create wallet
theborakompanioni Sep 9, 2023
4c08311
fix(ui): consistent button styles on Send page
theborakompanioni Sep 9, 2023
1a94c78
fix(ui): consistent button styles on Earn page
theborakompanioni Sep 9, 2023
6438a40
fix(ui): consistent button stlyes on MainWalletView page
theborakompanioni Sep 9, 2023
dea8e01
fix(ui): consistent button styles on Receive page
theborakompanioni Sep 9, 2023
50ec43c
refactor(CopyButton): remove sprites
theborakompanioni Sep 9, 2023
4400680
ui(Earn): reduce spacing between buttons
theborakompanioni Sep 9, 2023
9e03bc3
fix(ui): consistent button styles on Jam page
theborakompanioni Sep 9, 2023
fccc3d3
fix(ui): consistent button styles in CreateFidelityBond flow
theborakompanioni Sep 9, 2023
da1e593
fix(ui): border color of send/receive button on MainWalletView
theborakompanioni Sep 9, 2023
430f6aa
fix(ui): button spacing on Jam page
theborakompanioni Sep 9, 2023
0e38ced
dev(feat): add fast theme toggle to navbar
theborakompanioni Sep 9, 2023
fc3afc4
fix(ui): align onboarding flow
theborakompanioni Sep 9, 2023
3ea7c3e
dev(ui): hide fast theme toggle on small screens
theborakompanioni Sep 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions src/components/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { PropsWithChildren, useState, useEffect, useRef } from 'react'
import Sprite from './Sprite'
import { ReactNode, PropsWithChildren, useState, useEffect, useRef } from 'react'

const copyToClipboard = (
text: string,
Expand Down Expand Up @@ -69,10 +68,9 @@ function Copyable({ value, onSuccess, onError, className, children, ...props }:
}

interface CopyButtonProps extends CopyableProps {
text: React.ReactNode | string
successText?: React.ReactNode | string
text: ReactNode
successText?: ReactNode
successTextTimeout?: number
showSprites?: boolean
}

export function CopyButton({
Expand All @@ -83,7 +81,6 @@ export function CopyButton({
successText = text,
successTextTimeout = 1_500,
className,
showSprites = true,
...props
}: CopyButtonProps) {
const [showValueCopiedConfirmation, setShowValueCopiedConfirmation] = useState(false)
Expand Down Expand Up @@ -112,16 +109,7 @@ export function CopyButton({
}}
>
<div className="d-flex align-items-center justify-content-center">
{showSprites && (
<>
{showValueCopiedConfirmation ? (
<Sprite color="green" symbol="checkmark" className="me-1" width="20" height="20" />
) : (
<Sprite symbol="copy" className="me-1" width="20" height="20" />
)}
</>
)}
<>{showValueCopiedConfirmation ? successText : text}</>
{showValueCopiedConfirmation ? successText : text}
</div>
</Copyable>
)
Expand Down
22 changes: 11 additions & 11 deletions src/components/CreateWallet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useServiceInfo } from '../context/ServiceInfoContext'
import * as Api from '../libs/JmWalletApi'
import { routes } from '../constants/routes'
import { isDebugFeatureEnabled } from '../constants/debugFeatures'
import styles from './CreateWallet.module.css'

const BackupConfirmation = ({ wallet, onSuccess, onCancel }) => {
const { t } = useTranslation()
Expand Down Expand Up @@ -45,17 +44,18 @@ const BackupConfirmation = ({ wallet, onSuccess, onCancel }) => {
<div className="mb-4 text-center text-success">{t('create_wallet.feedback_seed_confirmed')}</div>
)}

<rb.Button variant="dark" className={styles.button} onClick={() => onSuccess()} disabled={!isSeedBackupConfirmed}>
<rb.Button
className="w-100 mb-4"
variant="dark"
size="lg"
disabled={!isSeedBackupConfirmed}
onClick={() => onSuccess()}
>
{t('create_wallet.confirmation_button_fund_wallet')}
</rb.Button>

<div className="d-flex mt-4 mb-4 gap-4">
<rb.Button
variant="outline-dark"
disabled={isSeedBackupConfirmed}
className={styles.button}
onClick={() => onCancel()}
>
<div className="d-flex justify-content-between mb-4 gap-4">
<rb.Button variant="none" disabled={isSeedBackupConfirmed} onClick={() => onCancel()}>
<div className="d-flex justify-content-center align-items-center">
<Sprite symbol="arrow-left" width="20" height="20" className="me-2" />
{t('create_wallet.back_button')}
Expand All @@ -64,10 +64,10 @@ const BackupConfirmation = ({ wallet, onSuccess, onCancel }) => {

{showSkipButton && (
<rb.Button
className="position-relative"
variant="outline-dark"
className={`${styles.button} position-relative`}
onClick={() => onSuccess()}
disabled={isSeedBackupConfirmed}
onClick={() => onSuccess()}
>
<div className="d-flex justify-content-center align-items-center">
{t('create_wallet.skip_button')}
Expand Down
59 changes: 28 additions & 31 deletions src/components/Earn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export default function Earn({ wallet }) {
<div className={styles['earn']}>
<PageTitle title={t('earn.title')} subtitle={t('earn.subtitle')} />

<rb.Row>
<rb.Row className="mb-2">
<rb.Col>
<rb.Fade in={serviceInfo?.coinjoinInProgress} mountOnEnter={true} unmountOnExit={true}>
<rb.Alert variant="info" className="mb-4">
Expand Down Expand Up @@ -610,21 +610,22 @@ export default function Earn({ wallet }) {
</>
</Accordion>
)}
<div className="mb-4">
<rb.Button
variant="dark"
type="submit"
className={styles['earn-btn']}
disabled={
isLoading ||
isSubmitting ||
serviceInfo?.rescanning === true ||
isWaitingMakerStart ||
isWaitingMakerStop
}
>
<div className="d-flex justify-content-center align-items-center">
{(isWaitingMakerStart || isWaitingMakerStop) && (
<rb.Button
className="w-100 mb-4"
variant="dark"
size="lg"
type="submit"
disabled={
isLoading ||
isSubmitting ||
serviceInfo?.rescanning === true ||
isWaitingMakerStart ||
isWaitingMakerStop
}
>
<div className="d-flex justify-content-center align-items-center">
{isWaitingMakerStart || isWaitingMakerStop ? (
<>
<rb.Spinner
as="span"
animation="border"
Expand All @@ -633,26 +634,22 @@ export default function Earn({ wallet }) {
aria-hidden="true"
className="me-2"
/>
)}
{isWaitingMakerStart || isWaitingMakerStop ? (
<>
{isWaitingMakerStart && t('earn.text_starting')}
{isWaitingMakerStop && t('earn.text_stopping')}
</>
) : (
<>{serviceInfo?.makerRunning === true ? t('earn.button_stop') : t('earn.button_start')}</>
)}
</div>
</rb.Button>
</div>
{isWaitingMakerStart && t('earn.text_starting')}
{isWaitingMakerStop && t('earn.text_stopping')}
</>
) : (
<>{serviceInfo?.makerRunning === true ? t('earn.button_stop') : t('earn.button_start')}</>
)}
</div>
</rb.Button>
</rb.Form>
</>
)}
</Formik>
)}
</rb.Col>
</rb.Row>
<rb.Row className="my-3">
<rb.Row className="mb-4">
<rb.Col className="d-flex justify-content-center">
<OrderbookOverlay
show={isShowOrderbook}
Expand All @@ -661,7 +658,7 @@ export default function Earn({ wallet }) {
/>
<rb.Button
variant="outline-dark"
className="border-0 mb-2 d-inline-flex align-items-center"
className="border-0 d-inline-flex align-items-center"
onClick={() => setIsShowOrderbook(true)}
>
<Sprite symbol="globe" width="24" height="24" className="me-2" />
Expand All @@ -673,7 +670,7 @@ export default function Earn({ wallet }) {

<rb.Button
variant="outline-dark"
className="border-0 mb-2 d-inline-flex align-items-center"
className="border-0 d-inline-flex align-items-center"
onClick={() => setIsShowReport(true)}
>
<Sprite symbol="show" width="24" height="24" className="me-2" />
Expand Down
5 changes: 0 additions & 5 deletions src/components/Earn.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
height: 3.5rem;
}

.earn .earn-btn {
height: 3rem;
width: 100%;
}

.inputGroupText {
width: 5ch;
display: inline-flex;
Expand Down
6 changes: 4 additions & 2 deletions src/components/ImportWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ const ImportWalletDetailsForm = ({
</rb.Button>
<div className="d-flex mb-4 gap-4">
<rb.Button variant="none" hidden={isSubmitting} disabled={isSubmitting} onClick={() => onCancel()}>
<Sprite symbol="arrow-left" width="20" height="20" className="me-2" />
{t('global.back')}
<div className="d-flex justify-content-center align-items-center">
<Sprite symbol="arrow-left" width="20" height="20" className="me-2" />
{t('global.back')}
</div>
</rb.Button>
</div>
</rb.Form>
Expand Down
5 changes: 0 additions & 5 deletions src/components/Jam.module.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.submit {
height: 3rem;
width: 100%;
}

.input {
height: 3.5rem;
width: 100%;
Expand Down
8 changes: 5 additions & 3 deletions src/components/Jam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,9 @@ export default function Jam({ wallet }: JamProps) {
</div>

<rb.Button
className={styles.submit}
className="w-100 mb-4"
variant="dark"
size="lg"
disabled={isLoading}
onClick={async () => {
await stopSchedule()
Expand Down Expand Up @@ -506,8 +507,9 @@ export default function Jam({ wallet }: JamProps) {
<p className="text-secondary mb-4">{t('scheduler.description_fees')}</p>

<rb.Button
className={styles.submit}
className="w-100 mb-4"
variant="dark"
size="lg"
type="submit"
disabled={isSubmitting || !isValid || serviceInfo?.rescanning === true}
>
Expand All @@ -520,7 +522,7 @@ export default function Jam({ wallet }: JamProps) {
)}
</Formik>

<rb.Row className="mt-5 mb-3">
<rb.Row className="mt-2 mb-4">
<rb.Col className="d-flex justify-content-center">
<rb.Button
variant="outline-dark"
Expand Down
7 changes: 5 additions & 2 deletions src/components/MainWalletView.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@
}

.sendReceiveButton {
padding: 0.25rem;
font-weight: 500;
border-color: rgba(222, 222, 222, 1) !important;
border-color: var(--bs-border-color) !important;
}

.sendReceiveButton:hover {
border-color: transparent !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
width: 100%;
}

.button {
height: 3rem;
width: 100%;
}

.seedwordIndexBackup {
width: 5ch;
justify-content: right;
Expand Down
2 changes: 1 addition & 1 deletion src/components/MnemonicWordInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as rb from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import styles from './CreateWallet.module.css'
import styles from './MnemonicWordInput.module.css'

interface MnemonicWordInputProps {
index: number
Expand Down
14 changes: 12 additions & 2 deletions src/components/Receive.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,18 @@ export default function Receive({ wallet }) {
<CopyButton
className="btn btn-outline-dark flex-1"
value={address}
text={t('receive.button_copy_address')}
successText={t('receive.text_copy_address_confirmed')}
text={
<>
<Sprite symbol="copy" className="me-1" width="24" height="24" />
{t('receive.button_copy_address')}
</>
}
successText={
<>
<Sprite color="green" symbol="checkmark" className="me-1" width="24" height="24" />
{t('receive.text_copy_address_confirmed')}
</>
}
disabled={!address || isLoading}
/>
{checkIsWebShareAPISupported() && <ShareButton value={address} className="flex-1" />}
Expand Down
1 change: 0 additions & 1 deletion src/components/Receive.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
}

.receive button {
padding: 0.25rem 1rem;
font-weight: 500;
border-color: rgba(222, 222, 222, 1);
}
Expand Down
15 changes: 2 additions & 13 deletions src/components/Send/Send.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,13 @@ input[type='number'] {
color: var(--bs-white) !important;
}

.button {
height: 3rem;
width: 100%;
}

.inputLoader {
height: 3.5rem;
border-radius: 0.25rem;
}

.serviceRunning .sendForm {
filter: blur(2px);
}

.serviceRunning .collaboratorsSelector {
filter: blur(2px);
}

.serviceRunning .sendForm,
.serviceRunning .collaboratorsSelector,
.serviceRunning .sendButton {
filter: blur(2px);
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -920,10 +920,11 @@ export default function Send({ wallet }: SendProps) {
</rb.Form>
<rb.Button
ref={submitButtonRef}
className={classNames('w-100', 'mb-4', styles.sendButton)}
variant={submitButtonOptions.variant}
size="lg"
type="submit"
disabled={isOperationDisabled || isLoading || isSending || !formIsValid}
className={classNames(styles.button, styles.sendButton, 'mb-4')}
form="send-form"
>
{isSending ? (
Expand Down
5 changes: 2 additions & 3 deletions src/components/WalletCreationConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { Formik } from 'formik'
import Seedphrase from './Seedphrase'
import ToggleSwitch from './ToggleSwitch'
import { walletDisplayName } from '../utils'
// TODO: currently reusing CreateWallet styles - move to own module.css?
import styles from './CreateWallet.module.css'

export type WalletInfo = {
walletFileName: string
Expand Down Expand Up @@ -82,8 +80,9 @@ const WalletCreationConfirmation = ({ wallet, submitButtonText, onSubmit }: Wall
/>
</div>
<rb.Button
className="w-100 mb-4"
variant="dark"
className={styles.button}
size="lg"
type="submit"
disabled={!sensitiveInfoWasRevealed || !userConfirmed || isSubmitting}
>
Expand Down
5 changes: 0 additions & 5 deletions src/components/WalletCreationForm.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@
height: 3.5rem;
width: 100%;
}

.button {
height: 3rem;
width: 100%;
}
Loading