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

[joy-ui][Card] Make orientation Responsive #40904

Open
MonstraG opened this issue Feb 2, 2024 · 5 comments
Open

[joy-ui][Card] Make orientation Responsive #40904

MonstraG opened this issue Feb 2, 2024 · 5 comments
Assignees
Labels
component: card This is the name of the generic UI component, not the React module! new feature New feature or request package: joy-ui Specific to @mui/joy waiting for 👍 Waiting for upvotes

Comments

@MonstraG
Copy link
Contributor

MonstraG commented Feb 2, 2024

Summary

I ended up in a situation where doing this:

<Card orientation={{xs: "vertical", md: "horizontal"}}>
	<NarrowContent/>
	<Divider />
	<WideContent/>
</Card>

would achieve result I want, that's about it.

Whilst writing this I thought that I would do it like I used to with useMediaQuery but turns out it's not in joy - #35037, so I guess I'll copy-paste content and display-hide/block it for now.

update: tried to extract content into it's own <MyCardContent/>:

<Card orientation="horizontal" sx={{ display: { xs: "none", md: "flex" } }}>
	<MyCardContent />
</Card>
<Card orientation="vertical" sx={{ display: { xs: "flex", md: "none" } }}>
	<MyCardContent />
</Card>

and that kinda failed because <Divider/> stopped behaving because it's no longer a direct child of Card, I'm kind of at a loss what to do.

Examples

No response

Motivation

No response

Search keywords: joy card orientation vertical horizontal responsive mobile desktop

@MonstraG MonstraG added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 2, 2024
@MonstraG
Copy link
Contributor Author

MonstraG commented Feb 2, 2024

If it turns out this is easy to do, then a good idea would be to update all orientations for all components that have them.

@danilo-leal danilo-leal changed the title [Joy][Card] Make orientation Responsive [joy-ui][Card] Make orientation Responsive Feb 3, 2024
@danilo-leal danilo-leal added component: card This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy labels Feb 3, 2024
@ZeeshanTamboli
Copy link
Member

Would adding the useMediaQuery hook to MUI System resolve your problem? See PR #39463 for #35037 fix.

@MonstraG
Copy link
Contributor Author

Technically yes, but the just like the other times in this PR, a css only solution is still preferred.

@ZeeshanTamboli
Copy link
Member

I'll add the "waiting for upvotes" label.

@ZeeshanTamboli ZeeshanTamboli added new feature New feature or request waiting for 👍 Waiting for upvotes and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 14, 2024
@emulienfou
Copy link

Having the same issue for the <List> component.
Would be nice to have the prop orientation handling responsive parameters like <List orientation={{xs: "vertical", md: "horizontal"}}> and same for all other components.

Also using useMediaQuery in some context with Next.js framework, this means your component needs to have use client instead of been a React server-component by example!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: card This is the name of the generic UI component, not the React module! new feature New feature or request package: joy-ui Specific to @mui/joy waiting for 👍 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

5 participants