Skip to content

Commit

Permalink
style: add wordpress loading (#1605)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-1979 authored Oct 24, 2024
1 parent d24e7d4 commit 9d8d0ec
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
25 changes: 19 additions & 6 deletions packages/extension-polkagate/src/components/Progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,30 @@
// SPDX-License-Identifier: Apache-2.0

import { Grid, useTheme } from '@mui/material';
//@ts-ignore
import { Circle, CubeGrid, WanderingCubes } from 'better-react-spinkit';
// @ts-ignore
import { Circle, CubeGrid, WanderingCubes, Wordpress } from 'better-react-spinkit';
import React from 'react';

interface Props {
direction?: 'column' | 'row'
fontSize?: number;
titlePaddingTop?: number;
titlePaddingLeft?: number;
title?: string;
pt?: number | string;
size?: number;
gridSize?: number;
type?: 'circle' | 'cubes' | 'grid';
type?: 'circle' | 'cubes' | 'grid' | 'wordpress';
}

function Progress ({ fontSize = 13, gridSize = 135, pt = '50px', size = 25, title, type = 'circle' }: Props): React.ReactElement<Props> {
function Progress ({ direction = 'column', fontSize = 13, gridSize = 135, pt = '50px', size = 25, title, titlePaddingTop = 20, titlePaddingLeft = 0, type = 'circle' }: Props): React.ReactElement<Props> {
const theme = useTheme();

return (
<Grid
alignItems='center'
container
direction='column'
direction={direction}
justifyContent='center'
pt={pt}
>
Expand All @@ -34,6 +37,12 @@ function Progress ({ fontSize = 13, gridSize = 135, pt = '50px', size = 25, titl
size={size}
/>
}
{type === 'wordpress' &&
<Wordpress
color={theme.palette.primary.main}
size={size}
/>
}
{type === 'cubes' &&
<WanderingCubes
color={theme.palette.primary.main}
Expand All @@ -55,7 +64,11 @@ function Progress ({ fontSize = 13, gridSize = 135, pt = '50px', size = 25, titl
{title &&
<Grid
item
sx={{ fontSize, paddingTop: '20px' }}
sx={{
fontSize,
pl: `${titlePaddingLeft}px`,
pt: `${titlePaddingTop}px`
}}
>
{title}
</Grid>
Expand Down
10 changes: 9 additions & 1 deletion packages/extension-polkagate/src/popup/history/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ export default function TransactionHistory (): React.ReactElement {
// staking transaction history is saved locally
tabIndex !== TAB_MAP.STAKING &&
((transfersTx?.hasMore)
? 'loading...'
? <Progress
direction='row'
pt='5px'
size={15}
title={t('Loading...')}
titlePaddingLeft={5}
titlePaddingTop={0}
type='wordpress'
/>
: !!tabHistory?.length &&
<Box fontSize={11}>
{t('No more transactions to load')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,15 @@ export default function HistoryModal ({ address, setDisplayPopup }: Props): Reac
// staking transaction history is saved locally
tabIndex !== TAB_MAP.STAKING &&
((transfersTx?.hasMore)
? 'loading...'
? <Progress
direction='row'
pt='5px'
size={15}
title={t('Loading...')}
titlePaddingLeft={5}
titlePaddingTop={0}
type='wordpress'
/>
: !!tabHistory?.length &&
<Box fontSize={11}>
{t('No more transactions to load')}
Expand Down

0 comments on commit 9d8d0ec

Please sign in to comment.