Skip to content

Commit

Permalink
Formattting.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcramer committed Jun 28, 2024
1 parent 6d017d0 commit cabb5d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/identity/components/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { getSlicedAddress } from '../getSlicedAddress';
import { cn, text } from '../../styles/theme';
import type { AddressReact } from '../types';

export function Address({ address = null, isSliced = true, className }: AddressReact) {
export function Address({
address = null,
isSliced = true,
className,
}: AddressReact) {
const { address: contextAddress } = useIdentityContext();
if (!contextAddress && !address) {
throw new Error(
Expand Down
8 changes: 4 additions & 4 deletions src/identity/components/Name.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export function Name({
return <span className={className} />;
}

const formattedAddress = isSliced ? getSlicedAddress(displayAddress) : displayAddress;
const formattedAddress = isSliced
? getSlicedAddress(displayAddress)
: displayAddress;

// It displays the ENS name if available; otherwise, it shows either a sliced version of the address
// or the full address, based on the 'sliced' prop. By default, 'sliced' is set to true.
Expand All @@ -53,9 +55,7 @@ export function Name({
>
{name ?? formattedAddress}
</span>
{badge && (
<DisplayBadge address={displayAddress}>{badge}</DisplayBadge>
)}
{badge && <DisplayBadge address={displayAddress}>{badge}</DisplayBadge>}
</div>
);
}
4 changes: 2 additions & 2 deletions src/identity/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { Address, Chain } from 'viem';
*/
export type AddressReact = {
address?: Address | null; // The Ethereum address to render.
isSliced?: Boolean; // Determines if the displayed address should be shortened.
isSliced?: boolean; // Determines if the displayed address should be shortened.
className?: string; // Optional className override for top span element.
};

Expand Down Expand Up @@ -141,7 +141,7 @@ export type IdentityReact = {
*/
export type NameReact = {
address?: Address | null; // Ethereum address to be displayed.
isSliced?: Boolean; // Determines if the displayed address should be shortened.
isSliced?: boolean; // Determines if the displayed address should be shortened.
className?: string; // Optional className override for top span element.
sliced?: boolean; // Determines if the address should be sliced when no ENS name is available.
children?: ReactNode; // Optional attestation by passing Badge component as its children
Expand Down

0 comments on commit cabb5d3

Please sign in to comment.