-
Notifications
You must be signed in to change notification settings - Fork 2
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
[#238] 홈페이지 초기 로딩 시 스켈레톤 UI 적용 및 code-highlighter 컴포넌트 스토리북 제작 #239
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1b526ac
🙀 chore: 로딩 시 스켈레톤 UI 추가 및 무한스크롤 커스텀 훅으로 분리
lee0jae330 850ec26
✨ feat: 코드 high-lighter storybook 추가
lee0jae330 7c3c122
Merge branch 'dev' of github.com:boostcampwm-2024/web31-BooLock into …
lee0jae330 97e7eaf
🙀 chore: let -> const로 변경
lee0jae330 254e1dc
Merge branch 'dev' into chore_1204
lee0jae330 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
44 changes: 44 additions & 0 deletions
44
apps/client/src/shared/code-highlighter/components/CodeContent/CodeContent.stories.tsx
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,44 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { CodeContent } from './CodeContent'; | ||
|
||
const meta: Meta<typeof CodeContent> = { | ||
title: 'shared/code-highlighter/CodeContent', | ||
component: CodeContent, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof CodeContent>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
code: `<html> | ||
<head></head> | ||
<body> | ||
<div> | ||
<h1>title</h1> | ||
<p>content</p> | ||
</div> | ||
</body> | ||
</html>`, | ||
codeLineList: [ | ||
'<html>', | ||
' <head></head>', | ||
' <body>', | ||
' <div>', | ||
' <h1>title</h1>', | ||
' <p>content</p>', | ||
' </div>', | ||
' </body>', | ||
'</html>', | ||
], | ||
selectedBlockStartLine: 5, | ||
selectedBlockLength: 7, | ||
selectedBlockType: 'BOOLOCK_SYSTEM_html', | ||
}, | ||
}; |
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
82 changes: 82 additions & 0 deletions
82
apps/client/src/shared/code-highlighter/components/CodeViewer/CodeViewer.stories.tsx
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,82 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { CodeViewer } from './CodeViewer'; | ||
|
||
const meta: Meta<typeof CodeViewer> = { | ||
title: 'shared/code-highlighter/CodeViewer', | ||
component: CodeViewer, | ||
parameters: { | ||
layout: 'fullscreen', | ||
}, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof CodeViewer>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
code: `<html> | ||
<head></head> | ||
<body> | ||
<div> | ||
<h1>title</h1> | ||
<p>content</p> | ||
</div> | ||
</body> | ||
</html>`, | ||
type: 'html', | ||
theme: 'light', | ||
}, | ||
}; | ||
|
||
export const DarkThemeHTML: Story = { | ||
args: { | ||
code: `<html> | ||
<head></head> | ||
<body> | ||
<div> | ||
<h1>title</h1> | ||
<p>content</p> | ||
</div> | ||
</body> | ||
</html>`, | ||
type: 'html', | ||
theme: 'dark', | ||
}, | ||
}; | ||
|
||
export const LightThemeCss: Story = { | ||
args: { | ||
code: `.title { | ||
background-color: red; | ||
} | ||
.content { | ||
font-size: 16px; | ||
font-weight: bold; | ||
font-family: 'Arial'; | ||
color: #000; | ||
} | ||
`, | ||
type: 'css', | ||
theme: 'light', | ||
}, | ||
}; | ||
|
||
export const DarkThemeCss: Story = { | ||
args: { | ||
code: `.title { | ||
background-color: red; | ||
} | ||
.content { | ||
font-size: 16px; | ||
font-weight: bold; | ||
font-family: 'Arial'; | ||
color: #000; | ||
} | ||
`, | ||
type: 'css', | ||
theme: 'dark', | ||
}, | ||
}; |
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
22 changes: 22 additions & 0 deletions
22
apps/client/src/shared/code-highlighter/components/LineNumbers/LineNumber.stories.tsx
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,22 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { LineNumbers } from './LineNumbers'; | ||
|
||
const meta: Meta<typeof LineNumbers> = { | ||
title: 'shared/code-highlighter/LineNumbers', | ||
component: LineNumbers, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['autodocs'], | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof LineNumbers>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
codeLineList: ['line1', 'line2', 'line3'], | ||
}, | ||
}; |
7 changes: 6 additions & 1 deletion
7
...de-highlighter/components/LineNumbers.tsx → ...er/components/LineNumbers/LineNumbers.tsx
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 +1 @@ | ||
export { CodeViewer } from './components/CodeViewer'; | ||
export { CodeViewer } from './components/CodeViewer/CodeViewer'; |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useEffect, useRef } from 'react'; | ||
|
||
type useInfiniteScrollProps = { | ||
intersectionCallback: IntersectionObserverCallback; | ||
}; | ||
|
||
export const useInfiniteScroll = ({ intersectionCallback }: useInfiniteScrollProps) => { | ||
const targetRef = useRef<HTMLDivElement | null>(null); | ||
|
||
const option = { | ||
root: null, | ||
rootMargin: '0px', | ||
threshold: 0.5, | ||
}; | ||
|
||
useEffect(() => { | ||
if (!targetRef.current) { | ||
return; | ||
} | ||
const observer = new IntersectionObserver(intersectionCallback, option); | ||
observer.observe(targetRef.current); | ||
return () => { | ||
if (targetRef.current) { | ||
observer.unobserve(targetRef.current); | ||
} | ||
}; | ||
}, [intersectionCallback]); | ||
return targetRef; | ||
}; |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ import { useWorkspaceChangeStatusStore } from '@/shared/store'; | |
|
||
export const usePreventLeaveWorkspacePage = () => { | ||
const { isBlockChanged, isCssChanged } = useWorkspaceChangeStatusStore(); | ||
let blocker = useBlocker( | ||
const blocker = useBlocker( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 꼼꼼하시네요👍🏻 |
||
({ currentLocation, nextLocation }) => | ||
currentLocation.pathname !== nextLocation.pathname && (isBlockChanged || isCssChanged) | ||
); | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsdoc 잊지 않고 신경써주셔서 감사합니다!