Skip to content

Commit

Permalink
prettier changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushtiwari110 committed Sep 28, 2023
1 parent 09da94b commit a29459d
Show file tree
Hide file tree
Showing 17 changed files with 199 additions and 163 deletions.
14 changes: 7 additions & 7 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -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.
]
// ...
}
// ...
"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.
]
// ...
}
56 changes: 28 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ jobs:
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
- 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
6 changes: 3 additions & 3 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Workflow name
name: "Deploy StoryBook on Chromatic"
name: 'Deploy StoryBook on Chromatic'

# Event for the workflow
on: [pull_request,push]
on: [pull_request, push]

# List of jobs
jobs:
Expand All @@ -27,4 +27,4 @@ jobs:
# Chromatic GitHub Action options
with:
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
12 changes: 6 additions & 6 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"semi": false,
"trailingComma": "es5",
"singleQuote": true,
"tabWidth": 2,
"useTabs": false
}
"semi": false,
"trailingComma": "es5",
"singleQuote": true,
"tabWidth": 2,
"useTabs": false
}
18 changes: 9 additions & 9 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/** @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,
date: /Date$/,
},
},
},
};
}

export default preview;
export default preview
14 changes: 7 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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
}
"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
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"chromatic": "npx chromatic --project-token=chpt_1a0522d85a68f99",
"prettier" : "npx prettier . --check"
"prettier": "npx prettier . --check"
},
"dependencies": {
"autoprefixer": "10.4.16",
Expand Down
2 changes: 1 addition & 1 deletion src/app/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-center p-24">
<h1 className="text-5xl font-bold z-20">BacPac</h1>
<h1 className="text-5xl font-bold z-20">BacPac</h1>
</main>
)
}
22 changes: 13 additions & 9 deletions src/stories/Button.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<button
type="button"
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
className={['storybook-button', `storybook-button--${size}`, mode].join(
' '
)}
{...props}
>
{label}
Expand All @@ -20,8 +24,8 @@ export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
}
`}</style>
</button>
);
};
)
}

Button.propTypes = {
/**
Expand All @@ -44,11 +48,11 @@ Button.propTypes = {
* Optional click handler
*/
onClick: PropTypes.func,
};
}

Button.defaultProps = {
backgroundColor: null,
primary: false,
size: 'medium',
onClick: undefined,
};
}
19 changes: 9 additions & 10 deletions src/stories/Button.stories.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -14,43 +14,42 @@ 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 = {
args: {
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',
}
};
},
}
Loading

0 comments on commit a29459d

Please sign in to comment.