Skip to content
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

ArtDirective を使用して、メディアに応じて異なる画像を返したいが、Picture Component の src property に設定した値しか使われない #128

Closed
akadori opened this issue Sep 11, 2024 · 3 comments

Comments

@akadori
Copy link

akadori commented Sep 11, 2024

PictureComponentが常にsrcset: "" を返すようになっており、メディアによる画像の切り替えがうまく行っていないように見えます。

@akadori
Copy link
Author

akadori commented Sep 11, 2024

連投すみません。

                            data-minista-transform-target={resolveTarget(item.src)}
                            data-minista-image-src={item.src}

このようにすると、私の意図した動きになりました。

以下のように使いたいのですが、使い方が間違っていますか?

                <Picture
                    src="/src/assets/default.png"
                    className="object-cover !h-[308px] md:!h-[746px]"
                    artDirectives={[
                        {
                            media: `(max-width: ${SP_BREAKPOINT}px)`,
                            src: "/src/assets/sp.png",
                            height: 308
                        },
                        {
                            media: `(min-width: ${SP_BREAKPOINT + 1}px)`,
                            src: "/src/assets/default.png",
                            height: 746
                        },
                    ]}
                />

qrac added a commit that referenced this issue Sep 12, 2024
@qrac
Copy link
Owner

qrac commented Sep 12, 2024

ご報告ありがとうございます!
確かにartDirectivesのsrcがsrcsetに使用されておらず、ご指摘の修正で改善されたため、v3.1.6にて修正を適応しリリースしました。コンポーネントの使い方は間違っていません。よろしくお願いします。

@akadori
Copy link
Author

akadori commented Sep 12, 2024

おはやい!対応ありがとうございます!

@akadori akadori closed this as completed Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants