/
ViewOnOpenSaucedButton.ts
27 lines (25 loc) · 1.01 KB
/
ViewOnOpenSaucedButton.ts
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
import logoIcon from "../../../assets/opensauced-icon.svg";
import "../../content-scripts.css";
import { createHtmlElement } from "../../../utils/createHtmlElement";
import { OPEN_SAUCED_INSIGHTS_DOMAIN } from "../../../constants";
export const ViewOnOpenSaucedButton = (username: string) => {
const viewOnOpenSaucedButton = createHtmlElement("a", {
id: "view-on-opensauced-button",
href: `https://${OPEN_SAUCED_INSIGHTS_DOMAIN}/user/${username}/contributions`,
className:
"inline-block mt-4 text-black bg-gh-white dark:bg-gh-gray dark:text-white rounded-md p-2 text-sm font-semibold text-center select-none w-full border hover:shadow-button hover:no-underline",
target: "_blank",
rel: "noopener noreferrer",
innerHTML: `
<img
class="mx-2 inline-block align-top"
src="${chrome.runtime.getURL(logoIcon)}"
alt="OpenSauced Logo"
width="20"
height="20"
/>
<span>View On OpenSauced</span>
`,
});
return viewOnOpenSaucedButton;
};