Added 'Highlighted Link' component for shared styling for links in light and dark themes
This commit is contained in:
parent
ee66bea4f4
commit
2857e8081e
22
apps/explorer/src/app/components/highlighted-link/index.tsx
Normal file
22
apps/explorer/src/app/components/highlighted-link/index.tsx
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
interface HighlightedLinkProps {
|
||||||
|
to: string;
|
||||||
|
text: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const HighlightedLink = ({
|
||||||
|
to,
|
||||||
|
text,
|
||||||
|
...props
|
||||||
|
}: HighlightedLinkProps) => {
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
className="font-bold underline dark:text-vega-yellow dark:font-normal dark:no-underline"
|
||||||
|
to={to}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{text}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
};
|
@ -55,7 +55,7 @@ export const TableHeader = ({
|
|||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}: TableHeaderProps) => {
|
}: TableHeaderProps) => {
|
||||||
const cellClasses = classnames(className, 'pl-4 dark:pl-0', {
|
const cellClasses = classnames(className, {
|
||||||
'text-left font-normal': props?.scope === 'row',
|
'text-left font-normal': props?.scope === 'row',
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
|
@ -15,6 +15,7 @@ import { TxsPerBlock } from '../../../components/txs/txs-per-block';
|
|||||||
import { Button } from '@vegaprotocol/ui-toolkit';
|
import { Button } from '@vegaprotocol/ui-toolkit';
|
||||||
import { Routes } from '../../router-config';
|
import { Routes } from '../../router-config';
|
||||||
import { RenderFetched } from '../../../components/render-fetched';
|
import { RenderFetched } from '../../../components/render-fetched';
|
||||||
|
import { HighlightedLink } from '../../../components/highlighted-link';
|
||||||
|
|
||||||
const Block = () => {
|
const Block = () => {
|
||||||
const { block } = useParams<{ block: string }>();
|
const { block } = useParams<{ block: string }>();
|
||||||
@ -60,13 +61,11 @@ const Block = () => {
|
|||||||
<TableRow modifier="bordered">
|
<TableRow modifier="bordered">
|
||||||
<TableHeader scope="row">Mined by</TableHeader>
|
<TableHeader scope="row">Mined by</TableHeader>
|
||||||
<TableCell modifier="bordered">
|
<TableCell modifier="bordered">
|
||||||
<Link
|
<HighlightedLink
|
||||||
data-testid="block-validator"
|
|
||||||
className="font-mono font-bold underline dark:text-vega-yellow dark:font-normal dark:no-underline"
|
|
||||||
to={`/${Routes.VALIDATORS}`}
|
to={`/${Routes.VALIDATORS}`}
|
||||||
>
|
text={header.proposer_address}
|
||||||
{header.proposer_address}
|
data-testid="block-validator"
|
||||||
</Link>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow modifier="bordered">
|
<TableRow modifier="bordered">
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Link } from 'react-router-dom';
|
import { Routes } from '../../router-config';
|
||||||
|
import { Result } from '../tendermint-transaction-response.d';
|
||||||
import {
|
import {
|
||||||
TableWithTbody,
|
TableWithTbody,
|
||||||
TableCell,
|
TableCell,
|
||||||
@ -6,8 +7,7 @@ import {
|
|||||||
TableRow,
|
TableRow,
|
||||||
} from '../../../components/table';
|
} from '../../../components/table';
|
||||||
import { TruncateInline } from '../../../components/truncate/truncate';
|
import { TruncateInline } from '../../../components/truncate/truncate';
|
||||||
import { Routes } from '../../router-config';
|
import { HighlightedLink } from '../../../components/highlighted-link';
|
||||||
import { Result } from '../tendermint-transaction-response.d';
|
|
||||||
|
|
||||||
interface TxDetailsProps {
|
interface TxDetailsProps {
|
||||||
txData: Result | undefined;
|
txData: Result | undefined;
|
||||||
@ -35,23 +35,16 @@ export const TxDetails = ({ txData, pubKey, className }: TxDetailsProps) => {
|
|||||||
Submitted by
|
Submitted by
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
<TableCell modifier="bordered" data-testid="submitted-by">
|
<TableCell modifier="bordered" data-testid="submitted-by">
|
||||||
<Link
|
<HighlightedLink to={`/${Routes.PARTIES}/${pubKey}`} text={pubKey} />
|
||||||
className="text-vega-yellow"
|
|
||||||
to={`/${Routes.PARTIES}/${pubKey}`}
|
|
||||||
>
|
|
||||||
{pubKey}
|
|
||||||
</Link>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow modifier="bordered">
|
<TableRow modifier="bordered">
|
||||||
<TableCell>Block</TableCell>
|
<TableCell>Block</TableCell>
|
||||||
<TableCell modifier="bordered" data-testid="block">
|
<TableCell modifier="bordered" data-testid="block">
|
||||||
<Link
|
<HighlightedLink
|
||||||
className="text-vega-yellow"
|
|
||||||
to={`/${Routes.BLOCKS}/${txData.height}`}
|
to={`/${Routes.BLOCKS}/${txData.height}`}
|
||||||
>
|
text={txData.height}
|
||||||
{txData.height}
|
/>
|
||||||
</Link>
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow modifier="bordered">
|
<TableRow modifier="bordered">
|
||||||
|
Loading…
Reference in New Issue
Block a user