-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #193 from NIAEFEUP/feature/actions
Add CI
- Loading branch information
Showing
5 changed files
with
242 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: CI | ||
|
||
on: | ||
push: # Run on pushes to "develop" | ||
branches: | ||
- develop | ||
pull_request: # Run on PRs to "develop" | ||
branches: | ||
- develop | ||
types: [opened, reopened, synchronize, ready_for_review] | ||
|
||
jobs: | ||
prettier: | ||
if: ${{ github.event.pull_request.draft == false }} | ||
|
||
name: Check Javascript code style | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 21 | ||
cache: yarn | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Run Prettier | ||
run: yarn format | ||
|
||
eslint: | ||
if: ${{ github.event.pull_request.draft == false }} | ||
|
||
name: Lint Javascript code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Enable Corepack | ||
run: corepack enable | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 21 | ||
cache: yarn | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Run Eslint | ||
run: yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
import jsx from "texsaur"; | ||
import Button from "../components/Button"; | ||
import { Table } from "../components/Table"; | ||
|
@@ -6,68 +7,94 @@ import Icon from "../components/Icon"; | |
const components = ["Icon", "Button", "Table"]; | ||
|
||
export function createComponentsPage() { | ||
if (!document.location.href.toLowerCase().includes("components")) { | ||
return; | ||
} | ||
document.body.innerHTML = ""; | ||
document.title = "Components"; | ||
if (!document.location.href.toLowerCase().includes("components")) { | ||
return; | ||
} | ||
document.body.innerHTML = ""; | ||
document.title = "Components"; | ||
|
||
const sidebarItems = components.map((component) => ( | ||
<a href={`#${component}`} key={component}> | ||
<li className="se-sidebar-item"> | ||
{component} | ||
</li> | ||
</a> | ||
)); | ||
const sidebarItems = components.map((component) => ( | ||
<a href={`#${component}`} key={component}> | ||
<li className="se-sidebar-item">{component}</li> | ||
</a> | ||
)); | ||
|
||
const page = ( | ||
<div className="se-docs-container"> | ||
{/* Sidebar */} | ||
<div className="se-sidebar"> | ||
<img src={chrome.runtime.getURL("images/logo/extended.png")} alt="NitSig Logo" width="100" /> | ||
<ul>{sidebarItems}</ul> | ||
</div> | ||
const page = ( | ||
<div className="se-docs-container"> | ||
{/* Sidebar */} | ||
<div className="se-sidebar"> | ||
<img | ||
src={chrome.runtime.getURL("images/logo/extended.png")} | ||
alt="NitSig Logo" | ||
width="100" | ||
/> | ||
<ul>{sidebarItems}</ul> | ||
</div> | ||
|
||
{/* Main Content */} | ||
<div className="se-main-content"> | ||
<h1>NitSig Components</h1> | ||
<div className="introduction"> | ||
<p>These components were created by the NitSig team in order to use them across the Sigarra pages.</p> | ||
<p>If you find something in your Sigarra that would be interesting to change by one of the following components, send an email to <a href="mailto:[email protected]">[email protected]</a>.</p> | ||
<p>Interesting to see the extension code base? Check our open source <a href="https://github.com/NIAEFEUP/nitsig" target="_blank" rel="noopener noreferrer">GitHub Repository</a>!</p> | ||
</div> | ||
{/* Main Content */} | ||
<div className="se-main-content"> | ||
<h1>NitSig Components</h1> | ||
<div className="introduction"> | ||
<p> | ||
These components were created by the NitSig team in | ||
order to use them across the Sigarra pages. | ||
</p> | ||
<p> | ||
If you find something in your Sigarra that would be | ||
interesting to change by one of the following | ||
components, send an email to{" "} | ||
<a href="mailto:[email protected]">[email protected]</a>. | ||
</p> | ||
<p> | ||
Interesting to see the extension code base? Check our | ||
open source{" "} | ||
<a | ||
href="https://github.com/NIAEFEUP/nitsig" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
GitHub Repository | ||
</a> | ||
! | ||
</p> | ||
</div> | ||
|
||
{/* Icon */} | ||
<Component name="Icon" | ||
description="Talking about icons, we exclusive use the Remix Icon library, the outlined style! Check remixicon.com for all the available icons." | ||
code={` | ||
{/* Icon */} | ||
<Component | ||
name="Icon" | ||
description="Talking about icons, we exclusive use the Remix Icon library, the outlined style! Check remixicon.com for all the available icons." | ||
code={` | ||
<Icon name="ri-notification-line" /> | ||
`} | ||
> | ||
<Icon name="ri-notification-line" /> | ||
</Component> | ||
> | ||
<Icon name="ri-notification-line" /> | ||
</Component> | ||
|
||
{/* Button */} | ||
<Component name="Button" | ||
description="Our button abstraction that can be used to create buttons with icons and text." | ||
code={` | ||
{/* Button */} | ||
<Component | ||
name="Button" | ||
description="Our button abstraction that can be used to create buttons with icons and text." | ||
code={` | ||
<Button | ||
name="my_button" | ||
text="Click me" | ||
icon="ri-notification-line" | ||
onclick={() => alert("Button was clicked")} | ||
/> | ||
`} | ||
> | ||
<Button | ||
title="my_button" | ||
icon="ri-notification-line" | ||
onclick={() => alert("Button was clicked")} | ||
/> | ||
</Component> | ||
|
||
> | ||
<Button title="my_button" icon="ri-notification-line" onclick={() => alert("Button was clicked")} /> | ||
</Component> | ||
|
||
|
||
{/* Table */} | ||
<Component name="Table" | ||
description="A simple table design with sorting capabilities on column headers." | ||
code={` | ||
{/* Table */} | ||
<Component | ||
name="Table" | ||
description="A simple table design with sorting capabilities on column headers." | ||
code={` | ||
<Table | ||
name="my_table" | ||
headers={[ | ||
|
@@ -81,42 +108,45 @@ export function createComponentsPage() { | |
]} | ||
/> | ||
`} | ||
> | ||
<Table | ||
name="my_table" | ||
headers={[ | ||
["Component", "Component"], | ||
["Description", "Description"], | ||
["Status", "Status"] | ||
]} | ||
data={[ | ||
["Button", "A button that can be clicked", "In progress"], | ||
["Input", "A text input field", "Complete"] | ||
]} | ||
/> | ||
</Component> | ||
</div> | ||
</div> | ||
); | ||
> | ||
<Table | ||
name="my_table" | ||
headers={[ | ||
["Component", "Component"], | ||
["Description", "Description"], | ||
["Status", "Status"], | ||
]} | ||
data={[ | ||
[ | ||
"Button", | ||
"A button that can be clicked", | ||
"In progress", | ||
], | ||
["Input", "A text input field", "Complete"], | ||
]} | ||
/> | ||
</Component> | ||
</div> | ||
</div> | ||
); | ||
|
||
document.body.appendChild(page); | ||
document.body.appendChild(page); | ||
} | ||
|
||
interface ComponentProps { | ||
name: string; | ||
description: string; | ||
code: string; | ||
name: string; | ||
description: string; | ||
code: string; | ||
} | ||
|
||
const Component: JSX.Component<ComponentProps> = ({ name, description, code }, children) => ( | ||
<div id={name} className="se-component-section" > | ||
<h2>{name}</h2> | ||
<p>{description}</p> | ||
<div className="se-component-show"> | ||
{children} | ||
const Component: JSX.Component<ComponentProps> = ( | ||
{ name, description, code }, | ||
children, | ||
) => ( | ||
<div id={name} className="se-component-section"> | ||
<h2>{name}</h2> | ||
<p>{description}</p> | ||
<div className="se-component-show">{children}</div> | ||
<pre className="se-code-block">{code}</pre> | ||
</div> | ||
<pre className="se-code-block"> | ||
{code} | ||
</pre> | ||
</div> | ||
); | ||
); |
Oops, something went wrong.