Fix anchor warning and update Icon component to use SvgIcon components
This commit is contained in:
parent
0a6532f34a
commit
18cf231d67
|
@ -232,7 +232,7 @@ export default class AutosuggestInput extends PureComponent<IAutosuggestInput> {
|
|||
}
|
||||
|
||||
return menu.map((item, i) => (
|
||||
<a
|
||||
<a // eslint-disable-line jsx-a11y/anchor-is-valid
|
||||
className={clsx('flex cursor-pointer items-center space-x-2 px-4 py-2.5 text-sm text-gray-700 hover:bg-gray-100 focus:bg-gray-100 dark:text-gray-500 dark:hover:bg-gray-800 dark:focus:bg-primary-800', { selected: suggestions.size - selectedSuggestion === i })}
|
||||
href='#'
|
||||
role='button'
|
||||
|
|
|
@ -9,7 +9,7 @@ import { getSettings } from 'soapbox/actions/settings';
|
|||
import { closeSidebar } from 'soapbox/actions/sidebar';
|
||||
import { useAccount } from 'soapbox/api/hooks';
|
||||
import Account from 'soapbox/components/account';
|
||||
import { Stack, Divider, HStack, Icon, IconButton, Text } from 'soapbox/components/ui';
|
||||
import { Stack, Divider, HStack, Icon, IconButton, Text, Button } from 'soapbox/components/ui';
|
||||
import ProfileStats from 'soapbox/features/ui/components/profile-stats';
|
||||
import { useAppDispatch, useAppSelector, useFeatures, useInstance } from 'soapbox/hooks';
|
||||
import { useSettingsNotifications } from 'soapbox/hooks/useSettingsNotifications';
|
||||
|
@ -123,11 +123,11 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
|||
};
|
||||
|
||||
const renderAccount = (account: AccountEntity) => (
|
||||
<a href='#' className='block py-2' onClick={handleSwitchAccount(account)} key={account.id}>
|
||||
<Button to='#' className='!block !border-none !p-0 !py-2 !text-primary-600 hover:!underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue' theme='muted' onClick={handleSwitchAccount(account)} key={account.id}>
|
||||
<div className='pointer-events-none'>
|
||||
<Account account={account} showProfileHoverCard={false} withRelationship={false} withLinkToProfile={false} />
|
||||
</div>
|
||||
</a>
|
||||
</Button>
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useParams } from 'react-router-dom';
|
|||
|
||||
import { fetchAboutPage } from 'soapbox/actions/about';
|
||||
import { Navlinks } from 'soapbox/components/navlinks';
|
||||
import { Card } from 'soapbox/components/ui';
|
||||
import { Button, Card } from 'soapbox/components/ui';
|
||||
import { useSoapboxConfig, useSettings, useAppDispatch } from 'soapbox/hooks';
|
||||
|
||||
import { languages } from '../preferences';
|
||||
|
@ -42,18 +42,18 @@ const AboutPage: React.FC = () => {
|
|||
{' '} {/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
|
||||
<ul className='inline list-none p-0'>
|
||||
<li className="inline after:content-['_·_']">
|
||||
<a href='#' onClick={() => setLocale(defaultLocale)}>
|
||||
<Button to='#' className='!border-none !p-0 !text-primary-600 hover:!underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue' theme='muted' onClick={() => setLocale(defaultLocale)}>
|
||||
{/* @ts-ignore */}
|
||||
{languages[defaultLocale] || defaultLocale}
|
||||
</a>
|
||||
</Button>
|
||||
</li>
|
||||
{
|
||||
pageLocales?.map(locale => (
|
||||
<li className="inline after:content-['_·_'] last:after:content-none" key={locale}>
|
||||
<a href='#' onClick={() => setLocale(locale)}>
|
||||
<Button to='#' className='!border-none !p-0 !text-primary-600 hover:!underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue' theme='muted' onClick={() => setLocale(locale)}>
|
||||
{/* @ts-ignore */}
|
||||
{languages[locale] || locale}
|
||||
</a>
|
||||
</Button>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
|
|
|
@ -78,11 +78,11 @@ const Backups = () => {
|
|||
<Card variant='rounded' size='lg'>
|
||||
{intl.formatMessage(messages.emptyMessage, {
|
||||
action: (
|
||||
<a href='#' onClick={handleCreateBackup}>
|
||||
<Button to='#' className='!border-none !p-0 !text-primary-600 hover:!underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue' theme='muted' onClick={handleCreateBackup}>
|
||||
<Text tag='span' theme='primary' size='sm' className='hover:underline'>
|
||||
{intl.formatMessage(messages.emptyMessageAction)}
|
||||
</Text>
|
||||
</a>
|
||||
</Button>
|
||||
),
|
||||
})}
|
||||
</Card>
|
||||
|
|
|
@ -2,6 +2,7 @@ import React, { useCallback } from 'react';
|
|||
import { FormattedList, FormattedMessage } from 'react-intl';
|
||||
|
||||
import { openModal } from 'soapbox/actions/modals';
|
||||
import { Button } from 'soapbox/components/ui';
|
||||
import { useAppDispatch, useAppSelector, useCompose, useFeatures, useOwnAccount } from 'soapbox/hooks';
|
||||
import { statusToMentionsAccountIdsArray } from 'soapbox/reducers/compose';
|
||||
import { makeGetStatus } from 'soapbox/selectors';
|
||||
|
@ -29,7 +30,7 @@ const ReplyMentions: React.FC<IReplyMentions> = ({ composeId }) => {
|
|||
|
||||
const parentTo = status && statusToMentionsAccountIdsArray(status, account!);
|
||||
|
||||
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||
e.preventDefault();
|
||||
|
||||
dispatch(openModal('REPLY_MENTIONS', {
|
||||
|
@ -43,19 +44,19 @@ const ReplyMentions: React.FC<IReplyMentions> = ({ composeId }) => {
|
|||
|
||||
if (to.size === 0) {
|
||||
return (
|
||||
<a href='#' className='reply-mentions' onClick={handleClick}>
|
||||
<Button to='#' className='mb-1 cursor-pointer !border-none !bg-transparent !p-0 text-sm !text-gray-700 dark:!text-gray-600' theme='muted' onClick={handleClick}>
|
||||
<FormattedMessage
|
||||
id='reply_mentions.reply_empty'
|
||||
defaultMessage='Replying to post'
|
||||
/>
|
||||
</a>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
const accounts = to.slice(0, 2).map((acct: string) => {
|
||||
const username = acct.split('@')[0];
|
||||
return (
|
||||
<span className='reply-mentions__account'> {/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
|
||||
<span className='inline-block text-primary-600 no-underline hover:text-primary-700 hover:underline dark:text-accent-blue dark:hover:text-accent-blue'>{/* eslint-disable-line formatjs/no-literal-string-in-jsx */}
|
||||
@{shortenNostr(username)}
|
||||
</span>
|
||||
);
|
||||
|
@ -68,7 +69,7 @@ const ReplyMentions: React.FC<IReplyMentions> = ({ composeId }) => {
|
|||
}
|
||||
|
||||
return (
|
||||
<a href='#' className='reply-mentions' onClick={handleClick}>
|
||||
<Button to='#' className='mb-1 cursor-pointer !border-none !p-0 text-sm !text-gray-700 focus:!ring-transparent focus:ring-offset-0 dark:!text-gray-600' theme='muted' onClick={handleClick}>
|
||||
<FormattedMessage
|
||||
id='reply_mentions.reply'
|
||||
defaultMessage='Replying to {accounts}'
|
||||
|
@ -76,7 +77,7 @@ const ReplyMentions: React.FC<IReplyMentions> = ({ composeId }) => {
|
|||
accounts: <FormattedList type='conjunction' value={accounts} />,
|
||||
}}
|
||||
/>
|
||||
</a>
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@ import React from 'react';
|
|||
|
||||
import { openModal } from 'soapbox/actions/modals';
|
||||
import CopyableInput from 'soapbox/components/copyable-input';
|
||||
import { Text, Icon, Stack, HStack } from 'soapbox/components/ui';
|
||||
import { Text, Stack, HStack, Button } from 'soapbox/components/ui';
|
||||
import SvgIcon from 'soapbox/components/ui/icon/svg-icon';
|
||||
import { useAppDispatch } from 'soapbox/hooks';
|
||||
|
||||
import { getExplorerUrl } from '../utils/block-explorer';
|
||||
|
@ -41,13 +42,13 @@ const CryptoAddress: React.FC<ICryptoAddress> = (props): JSX.Element => {
|
|||
<Text weight='bold'>{title || ticker.toUpperCase()}</Text>
|
||||
|
||||
<HStack alignItems='center' className='ml-auto'>
|
||||
<a className='ml-1 text-gray-500 rtl:ml-0 rtl:mr-1' href='#' onClick={handleModalClick}>
|
||||
<Icon src={require('@tabler/icons/outline/qrcode.svg')} size={20} />
|
||||
</a>
|
||||
<Button className='!ml-1 !border-none !p-0 !text-gray-500 focus:!ring-transparent focus:ring-offset-0 rtl:ml-0 rtl:mr-1' theme='muted' to='#' onClick={handleModalClick}>
|
||||
<SvgIcon src={require('@tabler/icons/outline/qrcode.svg')} size={20} />
|
||||
</Button>
|
||||
|
||||
{explorerUrl && (
|
||||
<a className='ml-1 text-gray-500 rtl:ml-0 rtl:mr-1' href={explorerUrl} target='_blank'>
|
||||
<Icon src={require('@tabler/icons/outline/external-link.svg')} size={20} />
|
||||
<SvgIcon src={require('@tabler/icons/outline/external-link.svg')} size={20} />
|
||||
</a>
|
||||
)}
|
||||
</HStack>
|
||||
|
|
|
@ -13,7 +13,6 @@ import { deleteStatusModal, toggleStatusSensitivityModal } from 'soapbox/actions
|
|||
import { initMuteModal } from 'soapbox/actions/mutes';
|
||||
import { initReport, ReportableEntities } from 'soapbox/actions/reports';
|
||||
import { deleteStatus } from 'soapbox/actions/statuses';
|
||||
import Icon from 'soapbox/components/icon';
|
||||
import StillImage from 'soapbox/components/still-image';
|
||||
import { Button, HStack, IconButton, Menu, MenuButton, MenuDivider, MenuItem, MenuLink, MenuList, Stack, Text } from 'soapbox/components/ui';
|
||||
import SvgIcon from 'soapbox/components/ui/icon/svg-icon';
|
||||
|
@ -421,7 +420,7 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
|
|||
|
||||
<Stack space={1}>
|
||||
<HStack alignItems='center' space={2}>
|
||||
<Icon src={require('@tabler/icons/outline/flag-3.svg')} />
|
||||
<SvgIcon src={require('@tabler/icons/outline/flag-3.svg')} />
|
||||
<span>
|
||||
<FormattedMessage
|
||||
id='event.organized_by'
|
||||
|
@ -441,8 +440,8 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
|
|||
</HStack>
|
||||
|
||||
<HStack alignItems='center' space={2}>
|
||||
<Icon src={require('@tabler/icons/outline/users.svg')} />
|
||||
<a href='#' className='hover:underline' onClick={handleParticipantsClick}>
|
||||
<SvgIcon src={require('@tabler/icons/outline/users.svg')} />
|
||||
<Button to='#' className='!border-none !p-0 !text-primary-600 hover:!underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue' theme='muted' onClick={handleParticipantsClick}>
|
||||
<span>
|
||||
<FormattedMessage
|
||||
id='event.participants'
|
||||
|
@ -453,14 +452,14 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
|
|||
}}
|
||||
/>
|
||||
</span>
|
||||
</a>
|
||||
</Button>
|
||||
</HStack>
|
||||
|
||||
<EventDate status={status} />
|
||||
|
||||
{event.location && (
|
||||
<HStack alignItems='center' space={2}>
|
||||
<Icon src={require('@tabler/icons/outline/map-pin.svg')} />
|
||||
<SvgIcon src={require('@tabler/icons/outline/map-pin.svg')} />
|
||||
<span>
|
||||
{event.location.get('name')}
|
||||
</span>
|
||||
|
|
|
@ -7,7 +7,7 @@ import MissingIndicator from 'soapbox/components/missing-indicator';
|
|||
import StatusContent from 'soapbox/components/status-content';
|
||||
import StatusMedia from 'soapbox/components/status-media';
|
||||
import TranslateButton from 'soapbox/components/translate-button';
|
||||
import { HStack, Icon, Stack, Text } from 'soapbox/components/ui';
|
||||
import { Button, HStack, Icon, Stack, Text } from 'soapbox/components/ui';
|
||||
import QuotedStatus from 'soapbox/features/status/containers/quoted-status-container';
|
||||
import { useAppDispatch, useAppSelector, useSettings, useSoapboxConfig } from 'soapbox/hooks';
|
||||
import { makeGetStatus } from 'soapbox/selectors';
|
||||
|
@ -47,7 +47,7 @@ const EventInformation: React.FC<IEventInformation> = ({ params }) => {
|
|||
setShowMedia(!showMedia);
|
||||
};
|
||||
|
||||
const handleShowMap: React.MouseEventHandler<HTMLAnchorElement> = (e) => {
|
||||
const handleShowMap: React.MouseEventHandler<HTMLButtonElement> = (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
dispatch(openModal('EVENT_MAP', {
|
||||
|
@ -89,9 +89,9 @@ const EventInformation: React.FC<IEventInformation> = ({ params }) => {
|
|||
text.push(
|
||||
<React.Fragment key='event-map'>
|
||||
<br />
|
||||
<a href='#' className='text-primary-600 hover:underline dark:text-accent-blue' onClick={handleShowMap}>
|
||||
<Button to='#' className='!border-none !p-0 !text-primary-600 hover:!underline focus:!ring-transparent focus:ring-offset-0 dark:!text-accent-blue' theme='muted' onClick={handleShowMap}>
|
||||
<FormattedMessage id='event.show_on_map' defaultMessage='Show on map' />
|
||||
</a>
|
||||
</Button>
|
||||
</React.Fragment>,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import clsx from 'clsx';
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import Icon from 'soapbox/components/icon';
|
||||
import { Button } from 'soapbox/components/ui';
|
||||
import SvgIcon from 'soapbox/components/ui/icon/svg-icon';
|
||||
import { useAppSelector } from 'soapbox/hooks';
|
||||
import { makeGetRemoteInstance } from 'soapbox/selectors';
|
||||
|
||||
|
@ -18,19 +19,19 @@ const RestrictedInstance: React.FC<IRestrictedInstance> = ({ host }) => {
|
|||
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
|
||||
const toggleExpanded: React.MouseEventHandler<HTMLAnchorElement> = e => {
|
||||
const toggleExpanded: React.MouseEventHandler<HTMLButtonElement> = e => {
|
||||
setExpanded((value) => !value);
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<a href='#' className='flex items-center gap-1 py-2.5 no-underline' onClick={toggleExpanded}>
|
||||
<Icon src={expanded ? require('@tabler/icons/outline/caret-down.svg') : require('@tabler/icons/outline/caret-right.svg')} />
|
||||
<Button to='#' className='flex items-center gap-1 !border-none !px-0 !py-2.5 !text-primary-600 no-underline focus:!ring-transparent focus:!ring-offset-0 dark:!text-accent-blue' onClick={toggleExpanded}>
|
||||
<SvgIcon src={expanded ? require('@tabler/icons/outline/caret-down.svg') : require('@tabler/icons/outline/caret-right.svg')} />
|
||||
<div className={clsx({ 'line-through': remoteInstance.federation.reject })}>
|
||||
{remoteInstance.host}
|
||||
</div>
|
||||
</a>
|
||||
</Button>
|
||||
<div
|
||||
className={clsx({
|
||||
'h-0 overflow-hidden': !expanded,
|
||||
|
|
Loading…
Reference in New Issue