Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/global/husky lint #40

Merged
merged 3 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": ["next/core-web-vitals", "prettier", "plugin:storybook/recommended"],
"settings": {
"next": {
"rootDir": "packages/nextjs-craft-blog-kit/"
"rootDir": "packages/blog/"
}
}
}
2 changes: 1 addition & 1 deletion .github/temp/craft_raw.json
Original file line number Diff line number Diff line change
Expand Up @@ -3965,4 +3965,4 @@
"alignmentStyle": "left",
"textStyle": "page"
}
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ yarn-error.log*

# Only dev module
background-extract

.eslintcache
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 2 additions & 6 deletions _contents/posts/41C3AD93-299C-4535-B94C-C772929265B1.json
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,7 @@
},
{
"color": "text",
"columns": [
{},
{},
{}
],
"columns": [{}, {}, {}],
"documentId": "DB29A26D-2759-4258-B42E-5BCED3A1A8B2",
"hasBlockDecoration": false,
"hasFocusDecoration": false,
Expand Down Expand Up @@ -1998,4 +1994,4 @@
],
"type": "textBlock"
}
}
}
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"eslint-plugin-storybook": "^0.5.9--canary.acfda00.0",
"husky": "^7.0.4",
"is-ci": "^3.0.1",
"lint-staged": "^12.3.8",
"next": "^12.1.5",
"prettier": "^2.6.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand All @@ -50,5 +52,9 @@
},
"dependencies": {
"framer-motion": "^6.3.0"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --cache --fix",
"*.{js,jsx,ts,tsx,css,sass,less,md,mdx}": "prettier --write"
}
}
3 changes: 0 additions & 3 deletions packages/blog/.eslintrc.json

This file was deleted.

26 changes: 13 additions & 13 deletions packages/blog/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module.exports = {
stories: [
"../stories/**/*.stories.mdx",
"../stories/**/*.stories.@(js|jsx|ts|tsx)",
"../components/**/*.stories.mdx",
"../components/**/*.stories.@(js|jsx|ts|tsx)",
'../stories/**/*.stories.mdx',
'../stories/**/*.stories.@(js|jsx|ts|tsx)',
'../components/**/*.stories.mdx',
'../components/**/*.stories.@(js|jsx|ts|tsx)',
],
addons: [
"storybook-addon-swc",
"@storybook/addon-a11y",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"storybook-addon-next-router",
'storybook-addon-swc',
'@storybook/addon-a11y',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'storybook-addon-next-router',
],
framework: "@storybook/react",
framework: '@storybook/react',
core: {
builder: "@storybook/builder-webpack5",
builder: '@storybook/builder-webpack5',
},
};
}
16 changes: 8 additions & 8 deletions packages/blog/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from "react";
import { RouterContext } from "next/dist/shared/lib/router-context"; // next 12
import { ThemeProvider } from "styled-components";
import { theme } from "../styles/theme";
import GlobalStyle from "../styles/glolbal-style";
import React from 'react'
import { RouterContext } from 'next/dist/shared/lib/router-context' // next 12
import { ThemeProvider } from 'styled-components'
import { theme } from '../styles/theme'
import GlobalStyle from '../styles/glolbal-style'

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
Expand All @@ -15,7 +15,7 @@ export const parameters = {
nextRouter: {
Provider: RouterContext.Provider,
},
};
}

export const decorators = [
(Story) => (
Expand All @@ -24,4 +24,4 @@ export const decorators = [
<Story />
</ThemeProvider>
),
];
]
22 changes: 11 additions & 11 deletions packages/blog/components/Header/Header.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import React from "react";
import { ComponentMeta, ComponentStory } from "@storybook/react";
import Header from "./Header";
import React from 'react'
import { ComponentMeta, ComponentStory } from '@storybook/react'
import Header from './Header'

export default {
title: "Components/Header",
title: 'Components/Header',
component: Header,
parameters: {
layout: "fullscreen",
layout: 'fullscreen',
},
} as ComponentMeta<typeof Header>;
} as ComponentMeta<typeof Header>

const Template: ComponentStory<typeof Header> = (args) => (
<div
style={{
boxSizing: "border-box",
height: "200vh",
boxSizing: 'border-box',
height: '200vh',
}}
>
<Header {...args} />
</div>
);
)

export const Primary = Template.bind({});
Primary.args = {};
export const Primary = Template.bind({})
Primary.args = {}
8 changes: 4 additions & 4 deletions packages/blog/components/Header/Header.styled.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { motion } from "framer-motion";
import styled from "styled-components";
import { motion } from 'framer-motion'
import styled from 'styled-components'

const Styled = {
rootContainer: styled(motion.header)`
Expand Down Expand Up @@ -47,6 +47,6 @@ const Styled = {
display: flex;
`,
search: styled(motion.div)``,
};
}

export default Styled;
export default Styled
56 changes: 28 additions & 28 deletions packages/blog/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import React, { useState } from "react";
import { useViewportScroll, MotionConfig } from "framer-motion";
import Styled from "./Header.styled";
import React, { useState } from 'react'
import { useViewportScroll, MotionConfig } from 'framer-motion'
import Styled from './Header.styled'

export type HeaderProps = {};
export type HeaderProps = {}

const Header: React.FC<HeaderProps> = ({}) => {
const { scrollY } = useViewportScroll();
const [isHero, setIsHero] = useState(scrollY.get() < 200);
const { scrollY } = useViewportScroll()
const [isHero, setIsHero] = useState(scrollY.get() < 200)

scrollY.onChange((value) => {
if (value < 200) {
setIsHero(true);
setIsHero(true)
} else {
setIsHero(false);
setIsHero(false)
}
});
})

return (
<MotionConfig
reducedMotion="user"
transition={{
type: "tween",
type: 'tween',
}}
>
<Styled.rootContainer
initial={scrollY.get() < 200 ? "hero" : "header"}
animate={isHero ? "hero" : "header"}
initial={scrollY.get() < 200 ? 'hero' : 'header'}
animate={isHero ? 'hero' : 'header'}
variants={{
hero: {
paddingTop: "64px",
backgroundColor: "#ffffff",
paddingTop: '64px',
backgroundColor: '#ffffff',
boxShadow: `0px`,
},
header: {
paddingTop: "0px",
backgroundColor: "#F5F5F7",
paddingTop: '0px',
backgroundColor: '#F5F5F7',
boxShadow: `0px 1px 2px rgba(0, 0, 0, 0.25)`,
},
}}
Expand All @@ -46,23 +46,23 @@ const Header: React.FC<HeaderProps> = ({}) => {
alt="JaeSeoKim's avatar"
variants={{
hero: {
width: "200px",
height: "200px",
width: '200px',
height: '200px',
},
header: {
width: "36px",
height: "36px",
width: '36px',
height: '36px',
},
}}
/>
<Styled.infoContainer>
<Styled.title
variants={{
hero: {
fontSize: "36px",
fontSize: '36px',
},
header: {
fontSize: "24px",
fontSize: '24px',
},
}}
>
Expand All @@ -71,15 +71,15 @@ const Header: React.FC<HeaderProps> = ({}) => {
<Styled.subtitle
variants={{
hero: {
fontSize: "24px",
fontSize: '24px',
opacity: 1,
scale: 1,
display: "flex",
display: 'flex',
},
header: {
opacity: 0,
scale: 0,
display: "none",
display: 'none',
},
}}
>
Expand All @@ -91,7 +91,7 @@ const Header: React.FC<HeaderProps> = ({}) => {
</Styled.mainContainer>
</Styled.rootContainer>
</MotionConfig>
);
};
)
}

export default Header;
export default Header
4 changes: 2 additions & 2 deletions packages/blog/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default } from "./Header";
export type { HeaderProps } from "./Header";
export { default } from './Header'
export type { HeaderProps } from './Header'
2 changes: 1 addition & 1 deletion packages/blog/stories/Introduction.stories.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/addon-docs";
import { Meta } from '@storybook/addon-docs'

<Meta title="Introduction" />

Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@types/react-dom": "*",
"@types/react-syntax-highlighter": "^13.5.2",
"@types/styled-components": "*",
"next": "^12.1.5"
"next": "*"
},
"dependencies": {
"@matejmazur/react-katex": "^3.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/Introduction.stories.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/addon-docs";
import { Meta } from '@storybook/addon-docs'

<Meta title="Introduction" />

Expand Down
Loading