forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change icons in web UI (mastodon#27385)
Co-authored-by: Renaud Chaput <renchap@gmail.com>
- Loading branch information
Showing
123 changed files
with
928 additions
and
726 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// eslint-disable-next-line import/no-anonymous-default-export | ||
export default 'SvgrURL'; | ||
export const ReactComponent = 'div'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,50 @@ | ||
import classNames from 'classnames'; | ||
|
||
interface Props extends React.HTMLAttributes<HTMLImageElement> { | ||
id: string; | ||
className?: string; | ||
fixedWidth?: boolean; | ||
import { ReactComponent as CheckBoxOutlineBlankIcon } from '@material-symbols/svg-600/outlined/check_box_outline_blank.svg'; | ||
|
||
interface SVGPropsWithTitle extends React.SVGProps<SVGSVGElement> { | ||
title?: string; | ||
} | ||
|
||
export type IconProp = React.FC<SVGPropsWithTitle>; | ||
|
||
interface Props extends React.SVGProps<SVGSVGElement> { | ||
children?: never; | ||
id: string; | ||
icon: IconProp; | ||
title?: string; | ||
} | ||
|
||
export const Icon: React.FC<Props> = ({ | ||
id, | ||
icon: IconComponent, | ||
className, | ||
fixedWidth, | ||
title: titleProp, | ||
...other | ||
}) => ( | ||
<i | ||
className={classNames('fa', `fa-${id}`, className, { 'fa-fw': fixedWidth })} | ||
{...other} | ||
/> | ||
); | ||
}) => { | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
if (!IconComponent) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
throw new Error(`<Icon id="${id}"> is missing an "icon" prop.`); | ||
} | ||
|
||
IconComponent = CheckBoxOutlineBlankIcon; | ||
} | ||
|
||
const ariaHidden = titleProp ? undefined : true; | ||
const role = !ariaHidden ? 'img' : undefined; | ||
|
||
// Set the title to an empty string to remove the built-in SVG one if any | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
const title = titleProp || ''; | ||
|
||
return ( | ||
<IconComponent | ||
className={classNames('icon', `icon-${id}`, className)} | ||
title={title} | ||
aria-hidden={ariaHidden} | ||
role={role} | ||
{...other} | ||
/> | ||
); | ||
}; |
Oops, something went wrong.