Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Community settings WIP.
  • Loading branch information
dessalines committed Dec 2, 2025
commit 868176b23654561fe4baa5168fd20675bfddf4da
108 changes: 41 additions & 67 deletions src/shared/components/common/icon.tsx
Original file line number Diff line number Diff line change
@@ -1,85 +1,59 @@
import { getStaticDir } from "@utils/env";
import classNames from "classnames";
import { Component } from "inferno";
import { I18NextService } from "../../services";

interface IconProps {
type IconProps = {
icon: string;
classes?: string;
inline?: boolean;
small?: boolean;
}
};

export class Icon extends Component<IconProps, any> {
constructor(props: any, context: any) {
super(props, context);
export function Icon({ icon, classes, inline, small }: IconProps) {
let iconAltText: string | undefined;
if (icon === "plus-square" || icon === "minus-square") {
iconAltText = `${I18NextService.i18n.t("show_content")}`;
}

render() {
let iconAltText: string | undefined;
if (
this.props.icon === "plus-square" ||
this.props.icon === "minus-square"
) {
iconAltText = `${I18NextService.i18n.t("show_content")}`;
}

return (
<svg
className={classNames("icon", this.props.classes, {
"icon-inline": this.props.inline,
small: this.props.small,
})}
{...(iconAltText
? { role: "img", "aria-describedby": `${this.props.icon}-alt` }
: {})}
>
{iconAltText && (
<title id={`${this.props.icon}-alt`}>{iconAltText}</title>
)}
<use
xlinkHref={`${getStaticDir()}/assets/symbols.svg#icon-${
this.props.icon
}`}
></use>
</svg>
);
}
return (
<svg
className={classNames("icon", classes, {
"icon-inline": inline,
small: small,
})}
{...(iconAltText
? { role: "img", "aria-describedby": `${icon}-alt` }
: {})}
>
{iconAltText && <title id={`${icon}-alt`}>{iconAltText}</title>}
<use
xlinkHref={`${getStaticDir()}/assets/symbols.svg#icon-${icon}`}
></use>
</svg>
);
}

interface SpinnerProps {
type SpinnerProps = {
large?: boolean;
className?: string;
};

export function Spinner({ large, className }: SpinnerProps) {
return (
<Icon
icon="spinner"
classes={classNames("spin", className, {
"spinner-large": large,
})}
/>
);
}

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>
);
}
export function PurgeWarning() {
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>
);
}
2 changes: 1 addition & 1 deletion src/shared/components/common/image-upload-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type BaseProps = {
imageSrc?: string;
rounded?: boolean;
disabled: boolean;
onImageChange: (imageSrc?: string) => void;
onImageChange(imageSrc?: string): void;
noConfirmation?: boolean;
};

Expand Down
Loading