-
Notifications
You must be signed in to change notification settings - Fork 1
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 #45 from pepabo/add_ci_workflow
PR作成時にlintとtestをgithub actionで実行する
- Loading branch information
Showing
19 changed files
with
130 additions
and
81 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,28 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.node-version' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run Lint | ||
run: npm run 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.node-version' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run Tests | ||
run: npm run test |
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
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 |
---|---|---|
|
@@ -43,4 +43,3 @@ | |
|
||
@return assert.equals("#{$actual}", "calc(2.5rem - 0.125rem)"); | ||
} | ||
|
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
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 |
---|---|---|
|
@@ -14,4 +14,4 @@ $title-margin-map: ( | |
s: xxs, | ||
m: xs, | ||
l: s | ||
) | ||
); |
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 |
---|---|---|
|
@@ -12,4 +12,3 @@ $available-appearance: ( | |
filled, | ||
outlined | ||
); | ||
|
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
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
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,20 +1,19 @@ | ||
import type { StoryFn, Meta } from '@storybook/react' | ||
import React from 'react' | ||
import Card, { Props } from './components/card/Card' | ||
import fixture from '../assets/fixture.jpg' | ||
import type { StoryFn, Meta } from "@storybook/react"; | ||
import React from "react"; | ||
import Card, { Props } from "./components/card/Card"; | ||
|
||
export default { | ||
title: 'Components/Card', | ||
component: Card | ||
} as Meta | ||
title: "Components/Card", | ||
component: Card, | ||
} as Meta; | ||
|
||
const Template: StoryFn<Props> = (args) => <Card {...args} /> | ||
const Template: StoryFn<Props> = (args) => <Card {...args} />; | ||
|
||
export const Index = Template.bind({}) | ||
export const Index = Template.bind({}); | ||
Index.args = { | ||
appearance: 'elevated', | ||
body: 'Card body', | ||
color: 'primary', | ||
appearance: "elevated", | ||
body: "Card body", | ||
color: "primary", | ||
isGapless: false, | ||
shape: 'circle' | ||
} | ||
shape: "circle", | ||
}; |
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,50 +1,40 @@ | ||
import React, { FC, ReactNode } from 'react' | ||
import { Shape } from '../types' | ||
import React, { FC } from "react"; | ||
import { Shape } from "../types"; | ||
|
||
export interface Props { | ||
appearance?: 'filled' | 'outlined' | 'elevated'; | ||
body?: string | ||
color?: 'primary' | 'secondary' | 'tertiary'; | ||
isGapless?: boolean | ||
shape?: Shape | ||
appearance?: "filled" | "outlined" | "elevated"; | ||
body?: string; | ||
color?: "primary" | "secondary" | "tertiary"; | ||
isGapless?: boolean; | ||
shape?: Shape; | ||
} | ||
|
||
const Card: FC<Props> = (props: Props) => { | ||
const { | ||
appearance, | ||
body, | ||
color, | ||
isGapless, | ||
shape, | ||
...rest | ||
} = props; | ||
|
||
const classes = [`in-card`] | ||
|
||
if (typeof appearance !== 'undefined') { | ||
classes.push(`-appearance-${appearance}`) | ||
const { appearance, body, color, isGapless, shape, ...rest } = props; | ||
|
||
const classes = [`in-card`]; | ||
|
||
if (typeof appearance !== "undefined") { | ||
classes.push(`-appearance-${appearance}`); | ||
} | ||
|
||
if (typeof color !== 'undefined') { | ||
classes.push(`-color-${color}`) | ||
if (typeof color !== "undefined") { | ||
classes.push(`-color-${color}`); | ||
} | ||
|
||
if (isGapless) { | ||
classes.push('-is-gapless') | ||
classes.push("-is-gapless"); | ||
} | ||
|
||
if (typeof shape !== 'undefined') { | ||
classes.push(`-shape-${shape}`) | ||
if (typeof shape !== "undefined") { | ||
classes.push(`-shape-${shape}`); | ||
} | ||
|
||
return ( | ||
<div | ||
className={classes.join(' ')} | ||
{...rest} | ||
> | ||
<div className={classes.join(" ")} {...rest}> | ||
{body || null} | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
export default Card | ||
export default Card; |
Oops, something went wrong.