| @@ -1,3 +1,4 @@ | |||||
| import { useState } from 'react' | |||||
| import YoutubeEmbed from 'react-youtube' | import YoutubeEmbed from 'react-youtube' | ||||
| import NicoViewer from '@/components/NicoViewer' | import NicoViewer from '@/components/NicoViewer' | ||||
| @@ -39,10 +40,24 @@ export default (({ post }: Props) => { | |||||
| } | } | ||||
| } | } | ||||
| return ( | |||||
| <a href={post.url} target="_blank"> | |||||
| <img src={post.thumbnailBase || post.thumbnail} | |||||
| alt={post.url} | |||||
| className="mb-4 w-full"/> | |||||
| </a>) | |||||
| const [framed, setFramed] = useState (false) | |||||
| return <>{ | |||||
| framed | |||||
| ? ( | |||||
| <iframe | |||||
| src={post.url} | |||||
| title={post.title || post.url} | |||||
| width={640} | |||||
| height={360}/>) | |||||
| : ( | |||||
| <a href="#" onClick={e => { | |||||
| e.preventDefault () | |||||
| setFramed (confirm ('未確認の外部ページを表示します。\n' | |||||
| + '悪意のあるスクリプトが実行される可能性があります。\n' | |||||
| + '表示しますか?')) | |||||
| return | |||||
| }}> | |||||
| 外部ページを表示 | |||||
| </a>)}</> | |||||
| }) satisfies FC<Props> | }) satisfies FC<Props> | ||||