]> Untitled Git - lemmy-ui.git/blob - src/shared/components/common/icon.tsx
Fixing nav-link
[lemmy-ui.git] / src / shared / components / common / icon.tsx
1 import { Component } from "inferno";
2
3 interface IconProps {
4   icon: string;
5   classes?: string;
6 }
7
8 export class Icon extends Component<IconProps, any> {
9   constructor(props: any, context: any) {
10     super(props, context);
11   }
12
13   render() {
14     return (
15       <svg class={`icon ${this.props.classes}`}>
16         <use xlinkHref={`#icon-${this.props.icon}`}></use>
17         <div class="sr-only">
18           <title>{this.props.icon}</title>
19         </div>
20       </svg>
21     );
22   }
23 }
24
25 interface SpinnerProps {
26   large?: boolean;
27 }
28
29 export class Spinner extends Component<SpinnerProps, any> {
30   constructor(props: any, context: any) {
31     super(props, context);
32   }
33
34   render() {
35     return (
36       <Icon
37         icon="spinner"
38         classes={`spin ${this.props.large && "spinner-large"}`}
39       />
40     );
41   }
42 }