Skip to content

Commit

Permalink
Fix TS errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Aug 21, 2024
1 parent e5922bc commit b942069
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function PoolDomain({ poolId, domain, refetch }: { poolId: string; domain: Domai
</ConnectionGuard>
) : (
pool.tranches.map((tranche) => (
<a href={explorer.address(domain.trancheTokens[tranche.id])} target="_blank">
<a href={explorer.address(domain.trancheTokens[tranche.id])} target="_blank" rel="noreferrer">
<Button variant="secondary" small style={{ width: '100%' }}>
<Shelf gap={1}>
<span>View {tranche.currency.symbol} token</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ type AccountButtonProps = {
multisig?: ComputedMultisig
}

const StyledText = styled(Text)`
display: block;
`

const Root = styled(Shelf)<{ selected: boolean }>`
cursor: pointer;
border: none;
Expand Down Expand Up @@ -138,7 +142,7 @@ export function AccountIcon({ id, theme = 'polkadot' }: { id: string; theme?: Ic
export function AccountName({ account, proxies }: { account: WalletAccount; proxies?: Proxy[] }) {
const utils = useCentrifugeUtils()
return (
<Text as="span" variant="body2" fontWeight={300} style={{ display: 'block' }}>
<StyledText as="span" variant="body2" fontWeight={300}>
{account.name && (
<>
<Text as="span" fontWeight={500}>
Expand All @@ -154,6 +158,6 @@ export function AccountName({ account, proxies }: { account: WalletAccount; prox
{truncateAddress(utils.formatAddress(p.delegator))}{' '}
</span>
))}
</Text>
</StyledText>
)
}
10 changes: 7 additions & 3 deletions fabric/src/components/Text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ interface SystemProps extends TypographySystemProps, ColorProps, TypographyProps
interface StyledTextProps extends SystemProps {
as?: keyof JSX.IntrinsicElements | React.ComponentType<any>
}

const StyledText = styled('span').withConfig({
shouldForwardProp: (prop) => shouldForwardProp(prop),
})<StyledTextProps>({ margin: 0 }, compose(typographySystem, typography, color))
Expand All @@ -45,14 +46,17 @@ function useTextContext(): React.ContextType<typeof TextContext> {
return React.useContext(TextContext)
}

interface TextProps extends StyledTextProps {
type AnchorProps = React.ComponentPropsWithoutRef<'a'>

interface TextProps extends StyledTextProps, Omit<AnchorProps, keyof StyledTextProps> {
variant?: keyof DefaultTheme['typography']
textOverflow?: 'ellipsis'
as?: keyof JSX.IntrinsicElements | React.ComponentType<any>
children?: React.ReactNode
htmlFor?: string
}
const Text = React.forwardRef<HTMLDivElement | HTMLSpanElement, TextProps>((props, ref) => {

const Text = React.forwardRef<HTMLDivElement | HTMLSpanElement | HTMLAnchorElement, TextProps>((props, ref) => {
const isInText = useTextContext()
const theme = useTheme()

Expand All @@ -78,7 +82,7 @@ const Text = React.forwardRef<HTMLDivElement | HTMLSpanElement, TextProps>((prop
<TextContext.Provider value>
<StyledText
as={as}
ref={ref as React.Ref<HTMLDivElement | HTMLSpanElement>}
ref={ref as React.Ref<HTMLDivElement | HTMLSpanElement | HTMLAnchorElement>}
color={color}
fontSize={fontSize}
fontWeight={fontWeight}
Expand Down

0 comments on commit b942069

Please sign in to comment.