chore: add sample UI

This commit is contained in:
abhijithvijayan 2020-01-30 20:41:52 +05:30
parent 892797233b
commit 9dc1446c07
4 changed files with 69 additions and 3 deletions

View File

@ -1 +1,3 @@
document.body.style.filter = 'invert(1)';
export {};

View File

@ -1,6 +1,6 @@
import React from 'react';
const Options = () => {
const Options: React.FC = () => {
return <div>Hello World</div>;
};

View File

@ -1,7 +1,40 @@
import React from 'react';
import { browser, Tabs } from 'webextension-polyfill-ts';
const Popup = () => {
return <div>Hello world</div>;
function openWebPage(url: string): Promise<Tabs.Tab> {
return browser.tabs.create({ url });
}
const Popup: React.FC = () => {
return (
<section id="popup">
<h2>WEB-EXTENSION-STARTER</h2>
<div className="links__holder">
<ul>
<li>
<button
type="button"
onClick={(): Promise<Tabs.Tab> => {
return openWebPage('https://github.com/abhijithvijayan/web-extension-starter');
}}
>
GitHub
</button>
</li>
<li>
<button
type="button"
onClick={(): Promise<Tabs.Tab> => {
return openWebPage('https://www.buymeacoffee.com/abhijithvijayan');
}}
>
Buy Me A Coffee
</button>
</li>
</ul>
</div>
</section>
);
};
export default Popup;

View File

@ -6,3 +6,34 @@ body {
color: $black;
background-color: $greyWhite;
}
#popup {
min-width: 350px;
padding: 30px 20px;
h2 {
font-size: 25px;
text-align: center;
}
.links__holder {
ul {
display: flex;
margin-top: 1em;
justify-content: space-around;
li {
button {
border-radius: 8%;
font-size: 20px;
font-weight: 600;
background-color: rgba(0, 0 ,255, 0.7);
color: white;
cursor: pointer;
padding: 8px 12px;
}
}
}
}
}