スタイル調整

feature-frontend-bug-fixes
Masaharu.Kato 4 months ago
parent 476b1cf21d
commit 2a961fd8c0
  1. 4
      frontend/src/App.css
  2. 9
      frontend/src/components/AddByRecipeDialog.tsx
  3. 43
      frontend/src/components/Layout.tsx
  4. 2
      frontend/src/index.css
  5. 4
      frontend/src/pages/RecipeList.tsx

@ -23,8 +23,8 @@ body {
/* Material UIのコンテナコンポーネントのカスタマイズ */ /* Material UIのコンテナコンポーネントのカスタマイズ */
.MuiContainer-root { .MuiContainer-root {
padding-top: 24px; /* padding-top: 24px;
padding-bottom: 24px; padding-bottom: 24px; */
} }
/* Material UIのペーパーコンポーネントのカスタマイズ */ /* Material UIのペーパーコンポーネントのカスタマイズ */

@ -76,10 +76,10 @@ const AddByRecipeDialog = ({
/> />
</DialogTitle> </DialogTitle>
<DialogContent dividers sx={{ padding: 2 }}> <DialogContent dividers sx={{ padding: 2 }}>
<Typography variant="h3"> <Typography sx={{fontSize: '1.5rem'}}>
{recipe.recipeName} {recipe.recipeName}
</Typography> </Typography>
<Typography> <Typography sx={{mt: 2, mb: 2}}>
({recipe.maxServings}) ({recipe.maxServings})
</Typography> </Typography>
<div> <div>
@ -108,7 +108,7 @@ const AddByRecipeDialog = ({
type="number" type="number"
margin="dense" margin="dense"
label="何人前" label="何人前"
fullWidth className="numberField"
defaultValue={1} defaultValue={1}
value={numOfPeople} value={numOfPeople}
onChange={(e) => { onChange={(e) => {
@ -116,7 +116,6 @@ const AddByRecipeDialog = ({
// setNumOfPeaple(!isNaN(num) ? num : ''); // setNumOfPeaple(!isNaN(num) ? num : '');
setNumOfPeaple(e.target.value); setNumOfPeaple(e.target.value);
}} }}
sx={{ minWidth: "8px", width: "100%" }}
inputProps={{ inputMode: "numeric", min: 1, pattern: "[0-9]*" }} // ここで整数のみ許可 inputProps={{ inputMode: "numeric", min: 1, pattern: "[0-9]*" }} // ここで整数のみ許可
/> />
@ -140,7 +139,7 @@ const AddByRecipeDialog = ({
const finalAddResult = await toBuyApi.addByRecipe(recipe.recipeId, num, checked); const finalAddResult = await toBuyApi.addByRecipe(recipe.recipeId, num, checked);
setOpenDialog(false); setOpenDialog(false);
if (finalAddResult.data.length === 0) { if (finalAddResult.data.length === 0) {
showInfoMessage('必要な食材が在庫にあったのでリストには追加されませんでした'); showInfoMessage('必要な食材が在庫にあったのでリストには追加されませんでした');
} else { } else {
showSuccessMessage('レシピが保存されて買うものリストに追加されました!'); showSuccessMessage('レシピが保存されて買うものリストに追加されました!');
} }

@ -76,10 +76,6 @@ const Layout: React.FC = () => {
navigate('/login'); navigate('/login');
}; };
// メニューを開閉するハンドラー // メニューを開閉するハンドラー
const toggleDrawer = () => { const toggleDrawer = () => {
setDrawerOpen(!drawerOpen); setDrawerOpen(!drawerOpen);
@ -119,7 +115,21 @@ const Layout: React.FC = () => {
sessionStorage.removeItem('globalMessage'); sessionStorage.removeItem('globalMessage');
}; };
const onBottomNaviChange = (event: React.SyntheticEvent, value: any) => {
setBottomNavi(value);
switch (value) {
case 0:
navigate('stock');
break;
case 1:
navigate('tasks');
break;
case 2:
navigate('recipeList');
break;
}
// ここでルーティング処理などを行う
}
return ( return (
<Box sx={{ display: 'flex', flexDirection: 'column', minHeight: '100vh' }}> <Box sx={{ display: 'flex', flexDirection: 'column', minHeight: '100vh' }}>
@ -135,29 +145,11 @@ const Layout: React.FC = () => {
</Toolbar> </Toolbar>
</AppBar> </AppBar>
<Paper sx={{ position: 'fixed', bottom: 0, left: 0, right: 0, zIndex: (theme) => theme.zIndex.drawer + 1 }} elevation={3}> <Paper sx={{ position: 'fixed', bottom: 0, left: 0, right: 0, zIndex: (theme) => theme.zIndex.drawer + 1 }} elevation={3}>
<BottomNavigation <BottomNavigation
showLabels showLabels
value={bottomNavi} value={bottomNavi}
onChange={(event, newValue) => { onChange={onBottomNaviChange}
setBottomNavi(newValue);
switch (newValue) {
case 0:
navigate('stock');
break;
case 1:
navigate('tasks');
break;
case 2:
navigate('recipeList');
break;
}
// ここでルーティング処理などを行う
}}
> >
<BottomNavigationAction label="在庫" icon={<InventoryIcon />} /> <BottomNavigationAction label="在庫" icon={<InventoryIcon />} />
<BottomNavigationAction label="買うもの" icon={<ShoppingCartIcon />} /> <BottomNavigationAction label="買うもの" icon={<ShoppingCartIcon />} />
@ -165,10 +157,9 @@ const Layout: React.FC = () => {
</BottomNavigation> </BottomNavigation>
</Paper> </Paper>
{/* メインコンテンツ領域 - 子ルートのコンポーネントがここに表示される */} {/* メインコンテンツ領域 - 子ルートのコンポーネントがここに表示される */}
<Box component="main" sx={{ flexGrow: 1, bgcolor: 'background.default', py: 3 }}> <Box component="main" sx={{ flexGrow: 1, bgcolor: 'background.default', py: 3 }}>
<Container sx={{ padding: 0, margin: 0 }}> <Container sx={{ padding: 0, mt: 0, mb: 0, mr: 'auto', ml: 'auto' }}>
<MessageContext.Provider value={{ showErrorMessage, showWarningMessage, showSuccessMessage, showInfoMessage }}> <MessageContext.Provider value={{ showErrorMessage, showWarningMessage, showSuccessMessage, showInfoMessage }}>
<MessageAlert <MessageAlert
open={msgOpen} open={msgOpen}

@ -18,7 +18,7 @@ html, body {
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
/* スクロールバーのレイアウトシフトを防止 */ /* スクロールバーのレイアウトシフトを防止 */
scrollbar-gutter: stable both-edges; scrollbar-gutter: stable both-edges;
overflow: auto overflow: auto;
} }
/* ルート要素のスタイル - Reactアプリケーションのマウントポイント */ /* ルート要素のスタイル - Reactアプリケーションのマウントポイント */

@ -114,7 +114,7 @@ const RecipeList: React.FC = () => {
<ListItemSecondaryAction> <ListItemSecondaryAction>
{recipe.maxServings ? {recipe.maxServings ?
<Typography variant="body1" component="span" sx={{ marginRight: '1em', color: "mediumaquamarine" }}> <Typography variant="body1" component="span" sx={{ mr: 0, color: "mediumaquamarine" }}>
{recipe.maxServings} {recipe.maxServings}
</Typography> </Typography>
: <></>} : <></>}
@ -132,7 +132,7 @@ const RecipeList: React.FC = () => {
</Tooltip> </Tooltip>
} }
<Tooltip title="編集"> <Tooltip title="編集" sx={{ml: 1}}>
<IconButton edge="end" aria-label="編集" <IconButton edge="end" aria-label="編集"
onClick={() => { onClick={() => {
navigate('/addRecipe/' + recipe.recipeId); navigate('/addRecipe/' + recipe.recipeId);

Loading…
Cancel
Save