diff --git a/src/client/components/v6/shared/cells/AlbumCell/index.stories.tsx b/src/client/components/v6/shared/cells/AlbumCell/index.stories.tsx index 7f9f701b45e..f2ef27020b7 100644 --- a/src/client/components/v6/shared/cells/AlbumCell/index.stories.tsx +++ b/src/client/components/v6/shared/cells/AlbumCell/index.stories.tsx @@ -26,8 +26,7 @@ export const Default = Template.bind({}); Default.args = { href: '/', title: 'ごめんねFingers Crossed', - number: '27', - type: 'single', + caption: '27th. single', image: { sm: '/images/artworks/singles/27/A@1x.jpg', md: '/images/artworks/singles/27/A@2x.jpg', @@ -41,8 +40,7 @@ export const LongTitle = Template.bind({}); LongTitle.args = { href: '/', title: '夜明けまで強がらなくてもいい', - number: '24', - type: 'single', + caption: '24th. single', image: { sm: '/images/artworks/singles/24/A@1x.jpg', md: '/images/artworks/singles/24/A@2x.jpg', @@ -56,8 +54,7 @@ export const FallbackBackground = Template.bind({}); FallbackBackground.args = { href: '/', title: 'ごめんねFingers Crossed', - number: '27', - type: 'single', + caption: '27th. single', image: { sm: '/images/artworks/singles/27/A@1x.jpg', md: '/images/artworks/singles/27/A@2x.jpg', diff --git a/src/client/components/v6/shared/cells/AlbumCell/index.tsx b/src/client/components/v6/shared/cells/AlbumCell/index.tsx index 2ee8e4a1f02..dba87eee8fd 100644 --- a/src/client/components/v6/shared/cells/AlbumCell/index.tsx +++ b/src/client/components/v6/shared/cells/AlbumCell/index.tsx @@ -7,8 +7,6 @@ import { getGlobalColorVarName, } from 'client/styles/tokens/colors'; import { ImageUrl } from 'server/types/commons'; -import { DiscographyType } from 'server/actors/Discography/types'; -import { useIntl } from 'client/i18n/hooks/useIntl'; import { CoverImage, parentAnimationStyles, @@ -17,17 +15,13 @@ import { export type AlbumCellProps = { href: string; title: string; - number: string; - type: DiscographyType; + caption?: string; image: ImageUrl; imageBackgroundColor?: string; titleBackgroundColor?: string; }; export const AlbumCell: React.FC = props => { - const { formatAlbumType } = useIntl(); - const caption = formatAlbumType(props.type, props.number); - return ( = props => { > = props => { - const { getTranslation } = useTranslations(); - return (
= props => { `} > = props => {
; + +const Template: Story = props => { + return ( +
+ +
+ ); +}; + +export const Default = Template.bind({}); +Default.args = { + href: '/', + title: 'ごめんねFingers crossed', + titleLang: 'ja', + number: 1, + caption: '#title', + image: { + sm: '/images/artworks/singles/27/A@1x.jpg', + md: '/images/artworks/singles/27/A@2x.jpg', + lg: '/images/artworks/singles/27/A@3x.jpg', + }, + titleBackgroundColor: '#f8b1b1', + imageBackgroundColor: '#bf0000', +}; + +export const Variation = Template.bind({}); +Variation.args = { + href: '/', + title: 'ざぶんざぶん', + titleLang: 'ja', + number: 4, + caption: '#unit', + image: { + sm: '/images/artworks/singles/27/B@1x.jpg', + md: '/images/artworks/singles/27/B@2x.jpg', + lg: '/images/artworks/singles/27/B@3x.jpg', + }, + imageBackgroundColor: '#ffa700', + titleBackgroundColor: '#fcda9c', +}; + +export const NoNumber = Template.bind({}); +NoNumber.args = { + href: '/', + title: 'ごめんねFingers crossed', + titleLang: 'ja', + caption: '#title', + image: { + sm: '/images/artworks/singles/27/A@1x.jpg', + md: '/images/artworks/singles/27/A@2x.jpg', + lg: '/images/artworks/singles/27/A@3x.jpg', + }, + titleBackgroundColor: '#f8b1b1', + imageBackgroundColor: '#bf0000', +}; + +export const NoCaption = Template.bind({}); +NoCaption.args = { + href: '/', + title: 'ごめんねFingers crossed', + titleLang: 'ja', + number: 1, + image: { + sm: '/images/artworks/singles/27/A@1x.jpg', + md: '/images/artworks/singles/27/A@2x.jpg', + lg: '/images/artworks/singles/27/A@3x.jpg', + }, + titleBackgroundColor: '#f8b1b1', + imageBackgroundColor: '#bf0000', +}; + +export const FallbackBackground = Template.bind({}); +FallbackBackground.args = { + href: '/', + title: 'ごめんねFingers crossed', + titleLang: 'ja', + number: 1, + caption: '#title', + image: { + sm: '/images/artworks/singles/27/A@1x.jpg', + md: '/images/artworks/singles/27/A@2x.jpg', + lg: '/images/artworks/singles/27/A@3x.jpg', + }, +}; diff --git a/src/client/components/v6/shared/cells/SongCell/index.tsx b/src/client/components/v6/shared/cells/SongCell/index.tsx new file mode 100644 index 00000000000..b634fc56f81 --- /dev/null +++ b/src/client/components/v6/shared/cells/SongCell/index.tsx @@ -0,0 +1,134 @@ +import { css } from '@emotion/react'; +import Link from 'next/link'; +import { Typography } from 'client/components/atoms/Typography'; +import { commonStyles } from 'client/styles/tokens'; +import { + getColorVarName, + getGlobalColorVarName, +} from 'client/styles/tokens/colors'; +import { ImageUrl } from 'server/types/commons'; +import { + CoverImage, + parentAnimationStyles, +} from 'client/components/v6/shared/images/CoverImage'; + +const getWrapperStyles = (isLink: boolean) => css` + display: inline-block; + width: 100%; + height: 100%; + vertical-align: bottom; + cursor: ${isLink ? 'pointer' : 'default'}; + + ${isLink ? parentAnimationStyles : undefined}; +`; + +const LinkWrapper: React.FC<{ + href?: string; + children: React.ReactNode; +}> = props => { + const { href, children } = props; + + return href !== undefined ? ( + +
{children} + + ) : ( +
{children}
+ ); +}; + +export type SongCellProps = { + href?: string; + title: string; + titleLang: string; + number?: string | number; + caption?: string; + image: ImageUrl; + imageBackgroundColor?: string; + titleBackgroundColor?: string; +}; + +export const SongCell: React.FC = props => { + return ( + +
+
+
+ {props.number && ( + + + {props.number} + + + )} + + {props.title} + +
+ +
+
+
+ ); +}; diff --git a/src/client/components/v6/shared/images/CoverImage/index.tsx b/src/client/components/v6/shared/images/CoverImage/index.tsx index 3d3eeb34fad..2103df72dce 100644 --- a/src/client/components/v6/shared/images/CoverImage/index.tsx +++ b/src/client/components/v6/shared/images/CoverImage/index.tsx @@ -9,6 +9,9 @@ import { Image } from 'client/components/atoms/image/Image'; import { ImageUrl } from 'server/types/commons'; import { joinClassNames } from 'client/utils/class'; +/** + * The styles to be applied to ``'s parent component. + */ export const parentAnimationStyles = css` & .image { transition: transform 0.3s cubic-bezier(0, 0.5, 0.7, 1);