diff --git a/.vscode/settings.json b/.vscode/settings.json index 1d6d78b..96037dc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" + }, } \ No newline at end of file diff --git a/src/components/TopBarText.tsx b/src/components/TopBarText.tsx new file mode 100644 index 0000000..c531ae6 --- /dev/null +++ b/src/components/TopBarText.tsx @@ -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 = ({ left, center, right }) => { + const navigate = useNavigate(); + switch (left) { + case "logo": + return ( +
+ + { + navigate("/"); + }} + > + + + + {center} + + + {right} + + +
+ ); + + case "back": + return ( +
+ + { + navigate(-1); + }} + > + + + + {center} + + + {right} + + +
+ ); + + case "none": + return ( +
+ + + + {center} + + + {right} + + +
+ ); + } +}; +export default TopBarText; diff --git a/src/styles/GlobalStyles.tsx b/src/styles/GlobalStyles.tsx index d1f7ec6..2e97179 100644 --- a/src/styles/GlobalStyles.tsx +++ b/src/styles/GlobalStyles.tsx @@ -2,6 +2,6 @@ import { createGlobalStyle } from "styled-components"; const GlobalStyle = createGlobalStyle` -` +`; -export default GlobalStyle; \ No newline at end of file +export default GlobalStyle; diff --git a/src/styles/TopBarText.styled.ts b/src/styles/TopBarText.styled.ts new file mode 100644 index 0000000..29ef125 --- /dev/null +++ b/src/styles/TopBarText.styled.ts @@ -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; +`;