forked from cypress-io/cypress-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
28 lines (24 loc) · 850 Bytes
/
index.tsx
File metadata and controls
28 lines (24 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import React from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
// TODO: refactor this component to be more efficient
export default function Icon({ name, color, inline, url, callout, contentType }) {
const iconName = name === "github" ? ["fab", "github"] : name;
const space = inline ? '.25rem' : '0.5rem'
let content;
if (callout) {
content = callout;
} else if (contentType === "lesson") {
content = 'Get the completed code for this lesson on GitHub';
} else if (contentType === "rwa") {
content = 'Real World App (RWA)'
url = 'https://github.com/cypress-io/cypress-realworld-app'
} else {
content = url;
}
return (
<>
<FontAwesomeIcon icon={iconName} color={color} />
{ url ? <a href={url} style={{ marginLeft: space }}>{ content }</a> : null}
</>
)
}