Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import type { FC } from 'react';

import { AssetRender } from '../../../AssetList/assetRender';

import { InfoPopOver } from './InfoPopOver';

import type { Asset } from '@/domains/Work/types';

import { Horizontal } from '@/components/Layout/Horizontal';
import { Vertical } from '@/components/Layout/Vertical';
import { DropImage } from '@/components/functional/DropImage';
import { Center } from '@/components/ui/Center';
Expand All @@ -23,27 +24,10 @@ export const AssetUpload: FC<Props> = ({ handleUploadAssets, assets }) => (
<Typography className="text-red-500" variant="body2">
必須
</Typography>
<InfoPopOver>
{`対応形式:\n 画像[.png .jpg .jpeg .bmp .gif]\n 動画[.mp4 .mov]\n 音源[.mp3 .wav .m4a ]\n モデル[.gltf .fbx]\n zip[.zip]`}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文字の前後の空白を入れるか入れないかで統一してほしいです
[.xxx] or [ .xxx ]
前者なら以下の修正

Suggested change
{`対応形式:\n 画像[.png .jpg .jpeg .bmp .gif]\n 動画[.mp4 .mov]\n 音源[.mp3 .wav .m4a ]\n モデル[.gltf .fbx]\n zip[.zip]`}
{`対応形式:\n 画像[.png .jpg .jpeg .bmp .gif]\n 動画[.mp4 .mov]\n 音源[.mp3 .wav .m4a]\n モデル[.gltf .fbx]\n zip[.zip]`}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<br />じゃだめ?(特に要件とか仕様は確認してないので,何か理由があるなら無視してOK.)

Suggested change
{`対応形式:\n 画像[.png .jpg .jpeg .bmp .gif]\n 動画[.mp4 .mov]\n 音源[.mp3 .wav .m4a ]\n モデル[.gltf .fbx]\n zip[.zip]`}
対応形式:
<br />
画像[.png .jpg .jpeg .bmp .gif]
<br />
動画[.mp4 .mov]
<br />
音源[.mp3 .wav .m4a ]
<br />
モデル[.gltf .fbx]
<br />
zip[.zip]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

拡張子情報は親要素から受け取るわけじゃないからpopoverの中に隠蔽しちゃっていいと思う

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

って思ったけどこれアセットとサムネイルで違うのか

</InfoPopOver>
</Vertical>
<Horizontal className="gap-0 items-start -mt-4">
<Typography variant="body2" className="text-gray-500">
対応形式:
</Typography>
<Typography variant="body2" className="text-xs text-gray-500 mx-4">
画像 [ .png .jpg .jpeg .bmp .gif ]
</Typography>
<Typography variant="body2" className="text-xs text-gray-500 mx-4">
動画 [ .mp4 .mov ]
</Typography>
<Typography variant="body2" className="text-xs text-gray-500 mx-4">
音源 [ .mp3 .wav .m4a ]
</Typography>
<Typography variant="body2" className="text-xs text-gray-500 mx-4">
モデル [ .gltf .fbx ]
</Typography>
<Typography variant="body2" className="text-xs text-gray-500 mx-4">
zip[ .zip ]
</Typography>
</Horizontal>
<Vertical className="gap-2 w-full overflow-scroll">
{assets.map((asset) => AssetRender(asset, 'w-24 p-0'))}
</Vertical>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { FC, ReactNode } from 'react';

import { Info } from 'lucide-react';

import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '@/components/ui/Tooltip';

type Props = {
children: ReactNode;
};

export const InfoPopOver: FC<Props> = ({ children }) => (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Infoだと情報が薄くて何の情報なのかわかりづらいからSupportExtPopOverとかにしてもいいかも

<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<Info size={16} color="#757575" />
</TooltipTrigger>
<TooltipContent className="rounded-md relative text-xl border-2 bg-white border-orange-pop">
<p className="whitespace-pre-wrap text-[10px] font-bold">{children}</p>
</TooltipContent>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<TooltipContent className="rounded-md relative text-xl border-2 bg-white border-orange-pop">
<p className="whitespace-pre-wrap text-[10px] font-bold">{children}</p>
</TooltipContent>
<TooltipContent className="rounded-md relative text-xl border-2 bg-white border-orange-pop">
{
supportedExts.map(({category,exts})=>(
<Vertical>
<Typography>
{category}
</Typography>
<span>
[
<Vertical>
{
exts.map((ext)=>(
<p>
.{ext}
</p>
))
}
<Vertical>
]
</Vertical>
))
}
</TooltipContent>

冗長ではあると思うけど私だったらこういうふうに書くかも(動くかどうかは確かめてない、あくまでイメージ)

supportedExtっていうpropsを取ってそれを元にPopoverがレンダリングする

supportedExtはcategoryextsをkeyに持つ構造体の配列

で親からsupportedExtを渡すだけでpopoverが統一されたスタイルでレンダリングをしてくれる

親が渡すsupportedExtは固定値で持っておけば何か変更があったとしても構造体を変えるだけでそれまでと同様のスタイルが保てる(文字列だと開発者がスタイルを気にして開発しなきゃいけなくなる(ドットだったりスペースだったり))

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます 勉強になりま
そんな感じにしてみます

</Tooltip>
</TooltipProvider>
);
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { FC } from 'react';

import { Horizontal } from '@/components/Layout/Horizontal';
import { InfoPopOver } from './InfoPopOver';

import { Vertical } from '@/components/Layout/Vertical';
import { DropImage } from '@/components/functional/DropImage';
import { Center } from '@/components/ui/Center';
Expand All @@ -24,15 +25,8 @@ export const ThumbnailUpload: FC<Props> = ({
<Typography variant="body2" className="text-red-500">
必須
</Typography>
<InfoPopOver>{`対応形式:\n 画像 [ .png .jpg .jpeg .bmp .gif ]`}</InfoPopOver>
</Vertical>
<Horizontal className="gap-0 items-start -mt-4">
<Typography variant="body2" className="text-gray-500">
対応形式:
</Typography>
<Typography variant="body2" className="text-xs text-gray-500 mx-4">
画像 [ .png .jpg .jpeg .bmp .gif ]
</Typography>
</Horizontal>
<DropImage
onDrop={(e) => {
if (e[0]) {
Expand Down