-
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
Feat#7 header bar #13
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2d435bf
add assets
YangJJune 2b44e83
Create TopBarText.tsx
YangJJune 0ce6de1
Add fonts and TopBarTextStyles
YangJJune 3de4d0f
Merge branch 'main' of https://github.com/KUIT-Space/KUIT-Space-front…
Turtle-Hwan be78770
setting: vscode setting 수정
Turtle-Hwan e55d026
style: TopBarText import 절대경로, styled-component 분리
Turtle-Hwan 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": true, | ||
}, | ||
"editor.formatOnSave": true, | ||
"source.fixAll": "always", | ||
}, | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
|
||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"[javascript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
} |
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,80 @@ | ||
import { FC } from "react"; | ||
import logo from "@/assets/logo_space.svg"; | ||
import back from "@/assets/icon_back.svg"; | ||
import * as sty from "@/styles/TopBarText.styled"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
export enum LeftEnum { | ||
Logo = "logo", | ||
Back = "back", | ||
None = "none", | ||
} | ||
|
||
interface topbarProps { | ||
left: LeftEnum; | ||
center: string; | ||
right: string; | ||
} | ||
|
||
const TopBarText: FC<topbarProps> = ({ left, center, right }) => { | ||
const navigate = useNavigate(); | ||
switch (left) { | ||
case "logo": | ||
return ( | ||
<div> | ||
<sty.StyledTopBarDiv> | ||
<sty.StyledLeftDiv | ||
onClick={() => { | ||
navigate("/"); | ||
}} | ||
> | ||
<img src={logo}></img> | ||
</sty.StyledLeftDiv> | ||
<sty.StyledCenterDiv> | ||
<sty.StyledCenterP>{center}</sty.StyledCenterP> | ||
</sty.StyledCenterDiv> | ||
<sty.StyledRightDiv> | ||
<sty.StyledRightP>{right}</sty.StyledRightP> | ||
</sty.StyledRightDiv> | ||
</sty.StyledTopBarDiv> | ||
</div> | ||
); | ||
|
||
case "back": | ||
return ( | ||
<div> | ||
<sty.StyledTopBarDiv> | ||
<sty.StyledLeftDiv | ||
onClick={() => { | ||
navigate(-1); | ||
}} | ||
> | ||
<img src={back}></img> | ||
</sty.StyledLeftDiv> | ||
<sty.StyledCenterDiv> | ||
<sty.StyledCenterP>{center}</sty.StyledCenterP> | ||
</sty.StyledCenterDiv> | ||
<sty.StyledRightDiv> | ||
<sty.StyledRightP>{right}</sty.StyledRightP> | ||
</sty.StyledRightDiv> | ||
</sty.StyledTopBarDiv> | ||
</div> | ||
); | ||
|
||
case "none": | ||
return ( | ||
<div> | ||
<sty.StyledTopBarDiv> | ||
<sty.StyledLeftDiv></sty.StyledLeftDiv> | ||
<sty.StyledCenterDiv> | ||
<sty.StyledCenterP>{center}</sty.StyledCenterP> | ||
</sty.StyledCenterDiv> | ||
<sty.StyledRightDiv> | ||
<sty.StyledRightP>{right}</sty.StyledRightP> | ||
</sty.StyledRightDiv> | ||
</sty.StyledTopBarDiv> | ||
</div> | ||
); | ||
} | ||
}; | ||
export default TopBarText; |
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,37 @@ | ||
import styled from "styled-components"; | ||
|
||
export const StyledTopBarDiv = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
`; | ||
|
||
export const StyledLeftDiv = styled.div` | ||
${(props) => props.onClick && "cursor: pointer;"} | ||
|
||
img { | ||
width: 120px; | ||
} | ||
`; | ||
|
||
export const StyledCenterDiv = styled.div` | ||
width: 160px; | ||
text-align: center; | ||
`; | ||
|
||
export const StyledRightDiv = styled.div` | ||
width: 160px; | ||
`; | ||
|
||
export const StyledCenterP = styled.p` | ||
font-family: "Freesentation M"; | ||
font-size: 20px; | ||
color: white; | ||
`; | ||
|
||
export const StyledRightP = styled.p` | ||
font-family: "Freesentation M"; | ||
font-size: 16px; | ||
color: white; | ||
margin-right: 22px; | ||
`; |
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.
요렇게 props 받아오는 걸로 바꿨습니다.
img 관련 css도 styled에 통일하기 위해 여기서 width 속성을 줬습니다.