-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from saitamau-maximum/development
Release: v1.0.0
- Loading branch information
Showing
15 changed files
with
188 additions
and
19 deletions.
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
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
Empty file.
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
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
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,3 @@ | ||
import { createContext } from "react"; | ||
|
||
export const ColorModeContext = createContext({ toggleColorMode: () => {} }); |
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,41 @@ | ||
import { ThemeProvider, createTheme } from "@mui/material/styles"; | ||
import { useMemo, useState, useEffect } from "react"; | ||
import { ColorModeContext } from "./ColorModeContext"; | ||
|
||
export const ColorModeProvider = ({ children }) => { | ||
const [mode, setMode] = useState(() => { | ||
const storedMode = localStorage.getItem("colorMode"); | ||
return storedMode !== null ? storedMode : "light"; | ||
}); | ||
|
||
useEffect(() => { | ||
localStorage.setItem("colorMode", mode); | ||
}, [mode]); | ||
|
||
const colorMode = useMemo( | ||
() => ({ | ||
toggleColorMode: () => { | ||
setMode((prevMode) => (prevMode === "light" ? "dark" : "light")); | ||
}, | ||
}), | ||
[] | ||
); | ||
|
||
const theme = useMemo( | ||
() => | ||
createTheme({ | ||
palette: { | ||
mode, | ||
}, | ||
}), | ||
[mode] | ||
); | ||
|
||
return ( | ||
<ThemeProvider theme={theme}> | ||
<ColorModeContext.Provider value={colorMode}> | ||
{children} | ||
</ColorModeContext.Provider> | ||
</ThemeProvider> | ||
); | ||
}; |
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,20 @@ | ||
import { useContext } from "react"; | ||
import { ColorModeContext } from "./ColorModeContext"; | ||
import { useTheme } from "@emotion/react"; | ||
import { Box } from "@mui/system"; | ||
import { IconButton } from "@mui/material"; | ||
import { Brightness4, Brightness7 } from "@mui/icons-material"; | ||
|
||
export const ToggleTheme = () => { | ||
const theme = useTheme(); | ||
const colorMode = useContext(ColorModeContext); | ||
const icon = | ||
theme.palette.mode === "dark" ? <Brightness7 /> : <Brightness4 />; | ||
return ( | ||
<Box sx={{ ml: 1 }}> | ||
<IconButton onClick={colorMode.toggleColorMode} color="inherit"> | ||
{icon} | ||
</IconButton> | ||
</Box> | ||
); | ||
}; |
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,38 @@ | ||
#!/bin/bash | ||
|
||
THIS_FILE_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
PROJECT_DIR="$(cd "${THIS_FILE_DIR}/.." && pwd)" | ||
FRONT_DIR="${PROJECT_DIR}/frontend" | ||
BACK_DIR="${PROJECT_DIR}/backend" | ||
DB_DATA_DIR="${PROJECT_DIR}/etc/mysql/dbdata" | ||
ENV_FILE="${PROJECT_DIR}/.env" | ||
|
||
echo "DBデータを削除してもよろしいですか?" | ||
echo "削除する場合は y を入力してください。" | ||
echo "削除しない場合は n を入力してください。" | ||
|
||
read -p "y/n: " yn | ||
|
||
case "$yn" in [yY]*) ;; *) | ||
echo "削除せずに終了します..." | ||
exit | ||
;; | ||
esac | ||
|
||
echo "Dockerを停止します..." | ||
|
||
docker compose down | ||
|
||
echo "Dockerを停止しました!" | ||
|
||
echo "DBデータを削除します..." | ||
|
||
sudo rm -rf "${DB_DATA_DIR}" | ||
|
||
echo "DBデータを削除しました!" | ||
|
||
echo "Dockerを立ち上げます..." | ||
|
||
docker compose up -d --build | ||
|
||
echo "Dockerを立ち上げました!" |
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,13 @@ | ||
#!/bin/bash | ||
|
||
THIS_FILE_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
PROJECT_DIR="$(cd "${THIS_FILE_DIR}/.." && pwd)" | ||
FRONT_DIR="${PROJECT_DIR}/frontend" | ||
BACK_DIR="${PROJECT_DIR}/backend" | ||
ENV_FILE="${PROJECT_DIR}/.env" | ||
|
||
echo "Dockerを立ち上げます..." | ||
|
||
docker compose up -d --build | ||
|
||
echo "Dockerを立ち上げました!" |
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,13 @@ | ||
#!/bin/bash | ||
|
||
THIS_FILE_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
PROJECT_DIR="$(cd "${THIS_FILE_DIR}/.." && pwd)" | ||
FRONT_DIR="${PROJECT_DIR}/frontend" | ||
BACK_DIR="${PROJECT_DIR}/backend" | ||
ENV_FILE="${PROJECT_DIR}/.env" | ||
|
||
echo "Dockerを終了します..." | ||
|
||
docker compose down | ||
|
||
echo "Dockerを終了しました!" |