diff --git a/.eslintrc.json b/.eslintrc.json index 3f1cfa8..9c11497 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,8 +1,8 @@ { - // ... - "extends": [ - "next/core-web-vitals", - "prettier" // Add "prettier" last. This will turn off eslint rules conflicting with prettier. This is not what will format our code. - ] - // ... - } \ No newline at end of file + // ... + "extends": [ + "next/core-web-vitals", + "prettier" // Add "prettier" last. This will turn off eslint rules conflicting with prettier. This is not what will format our code. + ] + // ... +} diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..f47ed64 --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,60 @@ +name: Workflow +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + build-project: #First Job is to check the code formatting, linting and build the project. + if: github.event.pull_request.draft == false + name: Run Prettier, Lint and Build Checks + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Install Node.js + uses: actions/setup-node@v2 + with: + node-version: 18 + + - name: Install Dependencies + run: npm install + + - name: Code Formatting Check #Runs Prettier Script + run: npm run prettier + + - name: Linting Check #Runs ESLint Script + run: npm run lint + + - name: Build #Build the project + run: npm run build + + - name: Check Build Status + run: | + if [ $? -eq 0 ]; then + echo "Build successful!🎉" + else + echo "Build failed!" + exit 1 + fi + + chromatic-deployment: #Second Job is to deploy the project to Chromatic + if: github.event.pull_request.draft == false + name: Deploy Storybook to Chromatic + runs-on: ubuntu-latest # Operating System + # Job steps + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 # 👈 Required to retrieve git history + - name: Install dependencies + run: npm install + # 👇 Adds Chromatic as a step in the workflow + - name: Publish to Chromatic + uses: chromaui/action@v1 + # Chromatic GitHub Action options + with: + # 👇 Chromatic projectToken, refer to the manage page to obtain it. + projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} diff --git a/.prettierrc.json b/.prettierrc.json index f6e6b22..043b0cd 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,7 +1,7 @@ { - "semi": false, - "trailingComma": "es5", - "singleQuote": true, - "tabWidth": 2, - "useTabs": false -} \ No newline at end of file + "semi": false, + "trailingComma": "es5", + "singleQuote": true, + "tabWidth": 2, + "useTabs": false +} diff --git a/.storybook/main.js b/.storybook/main.js index b2f24ca..43111ad 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,19 +1,19 @@ /** @type { import('@storybook/nextjs').StorybookConfig } */ const config = { - stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], + stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], staticDirs: ['../public'], addons: [ - "@storybook/addon-links", - "@storybook/addon-essentials", - "@storybook/addon-onboarding", - "@storybook/addon-interactions", + '@storybook/addon-links', + '@storybook/addon-essentials', + '@storybook/addon-onboarding', + '@storybook/addon-interactions', ], framework: { - name: "@storybook/nextjs", + name: '@storybook/nextjs', options: {}, }, docs: { - autodocs: "tag", + autodocs: 'tag', }, -}; -export default config; +} +export default config diff --git a/.storybook/preview.js b/.storybook/preview.js index 8602700..2d36066 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,8 +1,8 @@ /** @type { import('@storybook/react').Preview } */ -import '../src/app/globals.css'; +import '../src/app/globals.css' const preview = { parameters: { - actions: { argTypesRegex: "^on[A-Z].*" }, + actions: { argTypesRegex: '^on[A-Z].*' }, controls: { matchers: { color: /(background|color)$/i, @@ -10,6 +10,6 @@ const preview = { }, }, }, -}; +} -export default preview; +export default preview diff --git a/.vscode/settings.json b/.vscode/settings.json index dcde718..c91ad1b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,8 @@ { - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true - }, - // Add those two lines: - "editor.formatOnSave": true, // Tell VSCode to format files on save - "editor.defaultFormatter": "esbenp.prettier-vscode" // Tell VSCode to use Prettier as default file formatter -} \ No newline at end of file + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + // Add those two lines: + "editor.formatOnSave": true, // Tell VSCode to format files on save + "editor.defaultFormatter": "esbenp.prettier-vscode" // Tell VSCode to use Prettier as default file formatter +} diff --git a/package.json b/package.json index 74b8d69..568373b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "lint": "next lint", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", - "chromatic": "npx chromatic --project-token=chpt_1a0522d85a68f99" + "prettier": "npx prettier . --check", + "chromatic": "chromatic --exit-zero-on-changes" }, "dependencies": { "autoprefixer": "10.4.16", diff --git a/src/app/page.js b/src/app/page.js index fdae683..d7ec537 100644 --- a/src/app/page.js +++ b/src/app/page.js @@ -1,7 +1,7 @@ export default function Home() { return ( - BacPac + BacPac ) } diff --git a/src/stories/Button.jsx b/src/stories/Button.jsx index 7c613bb..876f523 100644 --- a/src/stories/Button.jsx +++ b/src/stories/Button.jsx @@ -1,16 +1,20 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import './button.css'; +import React from 'react' +import PropTypes from 'prop-types' +import './button.css' /** * Primary UI component for user interaction */ export const Button = ({ primary, backgroundColor, size, label, ...props }) => { - const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary'; + const mode = primary + ? 'storybook-button--primary' + : 'storybook-button--secondary' return ( {label} @@ -20,8 +24,8 @@ export const Button = ({ primary, backgroundColor, size, label, ...props }) => { } `} - ); -}; + ) +} Button.propTypes = { /** @@ -44,11 +48,11 @@ Button.propTypes = { * Optional click handler */ onClick: PropTypes.func, -}; +} Button.defaultProps = { backgroundColor: null, primary: false, size: 'medium', onClick: undefined, -}; +} diff --git a/src/stories/Button.stories.js b/src/stories/Button.stories.js index e8d8096..f7e9aac 100644 --- a/src/stories/Button.stories.js +++ b/src/stories/Button.stories.js @@ -1,4 +1,4 @@ -import { Button } from './Button'; +import { Button } from './Button' // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export const ButtonStories = { @@ -14,9 +14,9 @@ const ButtonStories = { argTypes: { backgroundColor: { control: 'color' }, }, -}; +} -export default ButtonStories; +export default ButtonStories // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args export const Primary = { @@ -24,33 +24,32 @@ export const Primary = { primary: true, label: 'Button', }, -}; +} export const Secondary = { args: { label: 'Button', }, -}; +} export const Large = { args: { size: 'large', label: 'Button', }, -}; +} export const Small = { args: { size: 'small', label: 'Button', }, -}; - +} export const Warning = { args: { primary: true, label: 'Delete now', backgroundColor: 'red', - } -}; + }, +} diff --git a/src/stories/Configure.mdx b/src/stories/Configure.mdx index e05f151..b762df6 100644 --- a/src/stories/Configure.mdx +++ b/src/stories/Configure.mdx @@ -1,36 +1,38 @@ -import { Meta } from "@storybook/blocks"; -import Image from "next/image"; - -import Github from "./assets/github.svg"; -import Discord from "./assets/discord.svg"; -import Youtube from "./assets/youtube.svg"; -import Tutorials from "./assets/tutorials.svg"; -import Styling from "./assets/styling.png"; -import Context from "./assets/context.png"; -import Assets from "./assets/assets.png"; -import Docs from "./assets/docs.png"; -import Share from "./assets/share.png"; -import FigmaPlugin from "./assets/figma-plugin.png"; -import Testing from "./assets/testing.png"; -import Accessibility from "./assets/accessibility.png"; -import Theming from "./assets/theming.png"; -import AddonLibrary from "./assets/addon-library.png"; - -export const RightArrow = () => ( + - - + > + + +) @@ -39,6 +41,7 @@ export const RightArrow = () => @@ -97,6 +100,7 @@ export const RightArrow = () => @@ -234,12 +238,12 @@ export const RightArrow = () => Star on GitHub - @@ -252,12 +256,12 @@ export const RightArrow = () => - @@ -270,12 +274,12 @@ export const RightArrow = () => - Follow guided walkthroughs on for key workflows. @@ -285,6 +289,7 @@ export const RightArrow = () => Discover tutorials +
Follow guided walkthroughs on for key workflows.