-
Notifications
You must be signed in to change notification settings - Fork 0
企画フレームの作成 #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+100
−4
Merged
企画フレームの作成 #120
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d56cf06
feat: EventFrame.tsxの作成
kiyo-jin cd49880
feat: 企画フレームの実装
kiyo-jin 86a16f3
feat: ツールチップの実装
kiyo-jin 6ec4ac2
style: テキスト部分の余白設定
kiyo-jin 9c42eba
feat: EventFrameの配置
kiyo-jin 0c7cc50
style: 背景をbg-white文字色をneutral-900に変更
kiyo-jin 8a9c00d
refactor: ツールチップのトリガー領域をカード全体になるようにリファクタ
kiyo-jin 9a47d24
style: pnpm fmtの実行
kiyo-jin eb02296
style: auto format by oxfmt
kiyo-jin 84dffdf
fix: aria-labelの追加、prefetchをfalseにした。imageAltを削除し装飾画像(alt="")に変更
kiyo-jin 6278e4b
refactor: MAX_LENGTH → DISPLAY_NAME_MAX_LENGTH、TEXTB_LENGTH → LARGE_T…
kiyo-jin f89efb4
refactor: altの削除
kiyo-jin 5a7048f
fix: 画像がない時のフォールバック追加
kiyo-jin 1479654
style: auto format by oxfmt
kiyo-jin 5d738f3
fix: 画像パスの修正
kiyo-jin c539ca3
style: pnpm fmtの実行
kiyo-jin 3103799
style: auto format by oxfmt
kiyo-jin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,76 @@ | ||
| "use client"; | ||
|
|
||
| import { useState } from "react"; | ||
| import Link from "next/link"; | ||
| import Image from "next/image"; | ||
| import { TooltipTrigger, Focusable } from "react-aria-components"; | ||
| import { Tooltip } from "@/components/aria/Tooltip"; | ||
|
|
||
| type EventFrameProps = { | ||
| name: string; | ||
| href: string; | ||
| imageUrl: string; | ||
| }; | ||
|
|
||
| const DISPLAY_NAME_MAX_LENGTH = 24; | ||
| const LARGE_TEXT_MAX_LENGTH = 14; | ||
| const TOOLTIP_OFFSET = -120; | ||
| const FALLBACK_LOGO = "/favicon/45th-LogoBlue.svg"; | ||
|
|
||
| export default function EventFrame(props: EventFrameProps) { | ||
| const { name, href, imageUrl } = props; | ||
|
|
||
| const [hasImageError, setHasImageError] = useState(false); | ||
|
|
||
| const handleImageError = () => { | ||
| setHasImageError(true); | ||
| }; | ||
|
|
||
| const isTruncated = name.length > DISPLAY_NAME_MAX_LENGTH; | ||
|
|
||
| const displayName = isTruncated ? name.slice(0, DISPLAY_NAME_MAX_LENGTH - 1) + "…" : name; | ||
|
|
||
| const nameClassName = | ||
| name.length <= LARGE_TEXT_MAX_LENGTH ? "text-textb" : "text-[14px] leading-[20px]"; | ||
|
|
||
| const card = ( | ||
| <Link | ||
| href={href} | ||
|
Comment on lines
+37
to
+38
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| aria-label={name} | ||
| prefetch={false} | ||
| className="flex h-[200px] w-[148px] flex-col rounded-lg bg-secondary pb-s shadow-[0px_6px_8px_rgba(60,224,232,0.6)] transition-all duration-200 hover:-translate-y-1 hover:shadow-[0px_6px_8px_rgba(60,224,232,1.0)]" | ||
| > | ||
| <div className="relative h-[111px] w-full shrink-0 overflow-hidden rounded-tl-lg rounded-tr-lg"> | ||
| {hasImageError ? ( | ||
| <Image className="object-contain" src={FALLBACK_LOGO} alt="" fill sizes="148px" /> | ||
| ) : ( | ||
| <Image | ||
| className="object-cover" | ||
| src={imageUrl} | ||
| alt="" | ||
| fill | ||
| sizes="148px" | ||
| onError={handleImageError} | ||
| /> | ||
| )} | ||
| </div> | ||
|
|
||
| <div className="mt-auto flex h-4l items-center px-s"> | ||
| <div className={nameClassName}>{displayName}</div> | ||
| </div> | ||
| </Link> | ||
| ); | ||
|
|
||
| if (!isTruncated) { | ||
| return card; | ||
| } | ||
|
|
||
| return ( | ||
| <TooltipTrigger delay={300} closeDelay={300}> | ||
| <Focusable>{card}</Focusable> | ||
| <Tooltip className="max-w-55 wrap-break-word" offset={TOOLTIP_OFFSET}> | ||
|
TkymHrt marked this conversation as resolved.
|
||
| {name} | ||
| </Tooltip> | ||
| </TooltipTrigger> | ||
| ); | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.