-
Notifications
You must be signed in to change notification settings - Fork 2
feature: first page markup #23
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
Open
dev-owen
wants to merge
2
commits into
petit-project/team3
Choose a base branch
from
petit-project/team3-wj
base: petit-project/team3
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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,43 +1,14 @@ | ||
| import * as React from 'react'; | ||
| import { styled } from '@stitches/react'; | ||
| import Wonjong from './components/Wonjong'; | ||
| import { Route, Routes } from 'react-router-dom'; | ||
|
|
||
| const App: React.FC = () => { | ||
| const [count, setCount] = React.useState<number>(0); | ||
|
|
||
| const increment = () => setCount((prev) => prev + 1); | ||
| const decrement = () => setCount((prev) => prev - 1); | ||
|
|
||
| return ( | ||
| <CounterBox> | ||
| <IncrementButton onClick={increment}>+</IncrementButton> | ||
| <CounterNumber>{count}</CounterNumber> | ||
| <DecrementButton onClick={decrement}>-</DecrementButton> | ||
| </CounterBox> | ||
| <Routes> | ||
| <Route path='wonjong' element={<Wonjong />} /> | ||
| {/*여기에 각자 route 처리해서 컴포넌트 넣어주시면 될 것 같아요.*/} | ||
| </Routes> | ||
| ); | ||
| }; | ||
|
|
||
| export default App; | ||
|
|
||
| const CounterBox = styled('div', { | ||
| width: '100vw', | ||
| height: '100vh', | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| justifyContent: 'center', | ||
| gap: 16, | ||
| }); | ||
|
|
||
| const CounterNumber = styled('span', { | ||
| fontSize: 24, | ||
| fontWeight: 700, | ||
| }); | ||
|
|
||
| const IncrementButton = styled('button', { | ||
| fontSize: 20, | ||
| fontWeight: 700, | ||
| }); | ||
|
|
||
| const DecrementButton = styled('button', { | ||
| fontSize: 20, | ||
| fontWeight: 700, | ||
| }); |
This file contains hidden or 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,58 @@ | ||
| import React, { ReactNode } from 'react'; | ||
| import { motion } from 'framer-motion'; | ||
| import * as $ from './styles'; | ||
|
|
||
| const item = { | ||
| hidden: { | ||
| y: '200%', | ||
| transition: { ease: [0.455, 0.03, 0.515, 0.955], duration: 0.85 }, | ||
| }, | ||
| visible: { | ||
| y: 0, | ||
| transition: { ease: [0.455, 0.03, 0.515, 0.955], duration: 0.75 }, | ||
| }, | ||
| }; | ||
| // Word wrapper | ||
| const Wrapper = ({ children }: { children: ReactNode }) => { | ||
| // We'll do this to prevent wrapping of words using CSS | ||
| return <motion.span className='word-wrapper'>{children}</motion.span>; | ||
| }; | ||
|
|
||
| const AnimatedText = ({ text }: { text: string }) => { | ||
| const words: string[][] = text.split(' ') | ||
| .map((el) => el.split('')) | ||
| .map((el) => [...el, '\u00A0']); | ||
|
|
||
| return ( | ||
| <$.H1Container style={{ 'bottom': `${Number(text) * 0.8}%` }}> | ||
| {words.map((word, index) => { | ||
| return ( | ||
| // Wrap each word in the Wrapper component | ||
| <Wrapper key={index}> | ||
| {words[index].flat().map((element, index) => { | ||
| return ( | ||
| <span | ||
| style={{ | ||
| overflow: 'hidden', | ||
| display: 'inline-block', | ||
| }} | ||
| key={index} | ||
| > | ||
| <motion.span | ||
| style={{ display: 'inline-block' }} | ||
| variants={item} | ||
| > | ||
| {element} | ||
| </motion.span> | ||
| </span> | ||
| ); | ||
| })} | ||
| </Wrapper> | ||
| ); | ||
| })} | ||
| {/* {} */} | ||
| </$.H1Container> | ||
| ); | ||
| }; | ||
|
|
||
| export default AnimatedText; | ||
This file contains hidden or 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,6 @@ | ||
| import { styled } from '@stitches/react'; | ||
|
|
||
| export const H1Container = styled('h1', { | ||
| fontSize: '100px', fontWeight: '900', textAlign: 'right', margin: '0 40px 0 0', position: 'absolute', right: '0' | ||
|
|
||
| }) |
This file contains hidden or 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,41 @@ | ||
| import React, { useEffect, useState } from 'react'; | ||
| import * as $ from './styles'; | ||
| import { motion } from 'framer-motion'; | ||
| import AnimatedText from '../AnimatedText'; | ||
|
|
||
| const Wonjong = () => { | ||
| const [randomNumbers, setRandomNumbers] = useState<number[]>([]); | ||
| useEffect(() => { | ||
| const number1 = Math.floor(Math.random() * 30); | ||
| const number2 = Math.floor(Math.random() * 20 + 40); | ||
| const number3 = Math.floor(Math.random() * 20 + 80); | ||
| setRandomNumbers([number1, number2, number3]); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <$.Wrapper> | ||
| <$.LeftTitleContainer> | ||
| Wonjong Oh <br /> | ||
| Frontend Web Developer | ||
| </$.LeftTitleContainer> | ||
| <motion.div | ||
| initial='hidden' | ||
| animate='visible' | ||
| variants={{ | ||
| hidden: { color: '#ffffff' }, | ||
| visible: { | ||
| transition: { | ||
| staggerChildren: 0.25, | ||
| }, | ||
| }, | ||
| }} | ||
| > | ||
| <AnimatedText text={String(randomNumbers[0])} /> | ||
| <AnimatedText text={String(randomNumbers[1])} /> | ||
| <AnimatedText text={String(randomNumbers[2])} /> | ||
| </motion.div> | ||
| </$.Wrapper> | ||
| ); | ||
| }; | ||
|
|
||
| export default Wonjong; |
This file contains hidden or 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,21 @@ | ||
| import { styled } from '@stitches/react'; | ||
|
|
||
| export const Wrapper = styled('div', { | ||
| backgroundColor: 'black', | ||
| color: 'white', | ||
| width: '100vw', | ||
| height: '100vh', | ||
| top: '0', | ||
| left: '0', | ||
| position: 'absolute', | ||
| fontSize: '60px', | ||
| fontWeight: '900', | ||
| textAlign: 'right', | ||
| margin: '0 40px 0 0' | ||
| }); | ||
|
|
||
| export const LeftTitleContainer = styled('p', { | ||
| fontSize: '40px', | ||
| fontWeight: '600', | ||
| textAlign: 'left', | ||
| }) |
This file contains hidden or 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,9 +1,12 @@ | ||
| import React from 'react'; | ||
| import ReactDOM from 'react-dom/client'; | ||
| import App from './App'; | ||
| import { BrowserRouter } from 'react-router-dom'; | ||
|
|
||
| ReactDOM.createRoot(document.getElementById('root')!).render( | ||
| <React.StrictMode> | ||
| <App /> | ||
| </React.StrictMode> | ||
| <BrowserRouter> | ||
| <App /> | ||
| </BrowserRouter> | ||
| </React.StrictMode>, | ||
| ); |
This file contains hidden or 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
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.
요 부분 flat().map() 해당 구분이랑 flatMap()과는 다른 동작이 진행되나요?
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.
flapMap 메서드는 제가 몰랐었는데 한 번 알아볼께요