mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-02 02:29:59 +00:00
751495702c
* Use git hash to break cache * Address PR feedback * Make hash docker agnostic * Add trailing slash * Update .prettierignore Co-authored-by: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> * Remove debugging log * implement getStaticDir util --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com> Co-authored-by: Alec Armbruster <35377827+alectrocute@users.noreply.github.com>
74 lines
1.6 KiB
TypeScript
74 lines
1.6 KiB
TypeScript
import { getStaticDir } from "@utils/env";
|
|
import classNames from "classnames";
|
|
import { Component } from "inferno";
|
|
import { I18NextService } from "../../services";
|
|
|
|
interface IconProps {
|
|
icon: string;
|
|
classes?: string;
|
|
inline?: boolean;
|
|
small?: boolean;
|
|
}
|
|
|
|
export class Icon extends Component<IconProps, any> {
|
|
constructor(props: any, context: any) {
|
|
super(props, context);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<svg
|
|
className={classNames("icon", this.props.classes, {
|
|
"icon-inline": this.props.inline,
|
|
small: this.props.small,
|
|
})}
|
|
>
|
|
<use
|
|
xlinkHref={`${getStaticDir()}/assets/symbols.svg#icon-${
|
|
this.props.icon
|
|
}`}
|
|
></use>
|
|
<div className="visually-hidden">
|
|
<title>{this.props.icon}</title>
|
|
</div>
|
|
</svg>
|
|
);
|
|
}
|
|
}
|
|
|
|
interface SpinnerProps {
|
|
large?: boolean;
|
|
className?: string;
|
|
}
|
|
|
|
export class Spinner extends Component<SpinnerProps, any> {
|
|
constructor(props: any, context: any) {
|
|
super(props, context);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Icon
|
|
icon="spinner"
|
|
classes={classNames("spin", this.props.className, {
|
|
"spinner-large": this.props.large,
|
|
})}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
export class PurgeWarning extends Component<any, any> {
|
|
constructor(props: any, context: any) {
|
|
super(props, context);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div className="purge-warning mt-2 alert alert-danger" role="alert">
|
|
<Icon icon="alert-triangle" classes="icon-inline me-2" />
|
|
{I18NextService.i18n.t("purge_warning")}
|
|
</div>
|
|
);
|
|
}
|
|
}
|