Skip to content

Commit

Permalink
Merge pull request #7 from push-protocol/f_push_scan
Browse files Browse the repository at this point in the history
ui fixes done
  • Loading branch information
rohitmalhotra1420 authored Nov 13, 2024
2 parents cf0fd6d + 9332e84 commit 26a37db
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 20 deletions.
24 changes: 15 additions & 9 deletions blocks/spinner/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';
import styled, { FlattenSimpleInterpolation, keyframes } from 'styled-components';
import styled, {
FlattenSimpleInterpolation,
keyframes,
} from 'styled-components';
import { SpinnerSize, SpinnerVariant } from './Spinner.types';
import { getSpinnerSize, getSpinnerColor } from './Spinner.utils';
import { Ellipse } from '../icons';
Expand All @@ -19,7 +22,11 @@ const spin = keyframes`
transform:rotate(360deg);
}
`;
const Container = styled.div<{ css?: FlattenSimpleInterpolation; size: SpinnerSize; variant?: SpinnerVariant }>`
const Container = styled.div<{
css?: FlattenSimpleInterpolation;
size: SpinnerSize;
variant?: SpinnerVariant;
}>`
display: flex;
align-items: center;
justify-content: center;
Expand All @@ -45,14 +52,13 @@ const Container = styled.div<{ css?: FlattenSimpleInterpolation; size: SpinnerSi
/* Custom CSS applied via styled component css prop */
${(props) => props.css || ''};
`;
const Spinner: React.FC<SpinnerProps> = ({ size = 'small', css, variant }) => {
const Spinner: React.FC<SpinnerProps> = ({
size = 'small',
css,
variant = 'primary',
}) => {
return (
<Container
size={size}
css={css}
variant={variant}
role="spinner"
>
<Container size={size} css={css} variant={variant} role="spinner">
<Ellipse size={getSpinnerSize(size)} />
</Container>
);
Expand Down
31 changes: 21 additions & 10 deletions blocks/table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export type TableProps = {
retrying?: boolean;
};

const StyledHeaderCell = styled(HeaderCell)<{ headerAlignment?: Column['headerAlignment'] }>`
const StyledHeaderCell = styled(HeaderCell)<{
headerAlignment?: Column['headerAlignment'];
}>`
${({ headerAlignment }) =>
headerAlignment
? `
Expand Down Expand Up @@ -113,7 +115,9 @@ const Table: FC<TableProps> = ({
retrying = false,
}) => {
const columnData = useMemo(() => {
const columnWidths = columns.map((col) => col.width || `${100 / columns.length}%`);
const columnWidths = columns.map(
(col) => col.width || `${100 / columns.length}%`
);

const leftRightPositionCSS = columns
.map((col, index) => {
Expand All @@ -127,7 +131,9 @@ const Table: FC<TableProps> = ({
if (col?.fixed == 'right') {
return `
&:nth-of-type(${index + 1}) {
right: ${index + 1 === columns.length ? '0px' : columnWidths[index]};
right: ${
index + 1 === columns.length ? '0px' : columnWidths[index]
};
};
`;
}
Expand Down Expand Up @@ -191,19 +197,22 @@ const Table: FC<TableProps> = ({
<TableContainer>
{loading && !error && (
<OverlayContainer blur>
<Spinner
size="medium"
variant="primary"
/>
<Spinner size="medium" variant="primary" />
<LoadingText>Loading</LoadingText>
</OverlayContainer>
)}
{!loading && !dataSource.length && (
<OverlayContainer>
<NullStateContainer>
{error ? <ErrorFilled size={24} /> : <Search size={24} />}
{error ? (
<ErrorFilled size={24} color="icon-primary" />
) : (
<Search size={24} color="icon-primary" />
)}
<NullStateTextContainer>
<NullStateHeading>{error ? 'Trouble Fetching Data' : 'No Results Found'}</NullStateHeading>
<NullStateHeading>
{error ? 'Trouble Fetching Data' : 'No Results Found'}
</NullStateHeading>
<NullStateDescription>
{error
? 'Please try again in a few minutes or reload the page.'
Expand Down Expand Up @@ -263,7 +272,9 @@ const Table: FC<TableProps> = ({
pinLeft={column?.fixed === 'left'}
pinRight={column?.fixed === 'right'}
>
{column.render ? column.render(cellValue, record) : cellValue}
{column.render
? column.render(cellValue, record)
: cellValue}
</StyledRowCell>
);
})}
Expand Down
5 changes: 4 additions & 1 deletion theme/globalStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const GlobalStyles = createGlobalStyle`
url('${basePath}/static/fonts/FKGroteskNeue-Regular.woff') format('woff');
font-weight: 100 400;
font-style: normal;
font-display: swap;
}
@font-face {
Expand All @@ -20,6 +21,7 @@ export const GlobalStyles = createGlobalStyle`
font-weight: 500 600;
font-style: normal;
font-display: swap;
}
@font-face {
Expand All @@ -28,6 +30,7 @@ export const GlobalStyles = createGlobalStyle`
url('${basePath}/static/fonts/FKGroteskNeue-Bold.woff') format('woff');
font-weight: 700 800;
font-style: normal;
font-display: swap;
}
body {
Expand All @@ -43,7 +46,7 @@ export const GlobalStyles = createGlobalStyle`
:root {
/* Font Family */
--font-family: 'FK Grotesk Neu';
--font-family: 'FK Grotesk Neu', Arial, sans-serif;
${(props) => getBlocksCSSVariables(props.theme.blocksTheme)}
}
Expand Down

0 comments on commit 26a37db

Please sign in to comment.