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

Allow a Stylekit "card" to be side-by-side with width=fit-content #1780

Closed
1 of 6 tasks
arcanaxion opened this issue Sep 12, 2024 · 15 comments · Fixed by #2223
Closed
1 of 6 tasks

Allow a Stylekit "card" to be side-by-side with width=fit-content #1780

arcanaxion opened this issue Sep 12, 2024 · 15 comments · Fixed by #2223
Assignees
Labels
🖰 GUI Related to GUI hacktoberfest - 200💎💎 Issues rewarded by 200 points hacktoberfest hacktoberfest issues 🆘 Help wanted Open to participation from the community 📈 Improvement Improvement of a feature. 🟨 Priority: Medium Not blocking but should be addressed ⚔️ Quest Tracks quest-bot quests

Comments

@arcanaxion
Copy link

Description

Cards can have their width match the size of its content with #468, which is great for displaying metrics (among other things).

I'd like to position cards side-by-side, without needing to use a layout and explicitly defining the width of each element there.

Currently, I can use a layout and define the width:

from taipy.gui import Gui, Markdown

page_md_target = Markdown(
"""
<|layout|columns=10em 10em|

<|card|part|width=fit-content|
Metric 1
|>

<|card|part|width=fit-content|
Metric 2
|>

|>
""")

if __name__ == "__main__":
    gui = Gui(page_md_target)
    gui.run(debug=True, run_browser=False, use_reloader=True, dark_mode=False)

Which produces:

image

I want to create this without defining a width anywhere.

Solution Proposed

Maybe allowing a layout column to "fit-content" ("fc") is a possible solution? I don't like the extra nesting especially if I'm only showing 2 cards, but it makes sense and I can also use layout.gap to add space between the cards.

page_md_layout = Markdown(
"""
<|layout|columns=fc fc|

<|card|part|width=fit-content|
Metric 1
|>

<|card|part|width=fit-content|
Metric 2
|>

|>
""")

Impact of Solution

Needs to work with taipy.gui.builder / tgb also.

Additional Context

No response

Acceptance Criteria

  • Ensure new code is unit tested, and check code coverage is at least 90%.
  • Create related issue in taipy-doc for documentation and Release Notes.
  • Check if a new demo could be provided based on this, or if legacy demos could be benefit from it.
  • Ensure any change is well documented.

Code of Conduct

  • I have checked the existing issues.
  • I am willing to work on this issue (optional)
@arcanaxion
Copy link
Author

@dinhlongviolin1 Opened a new feature request per #1725. Thanks for taking a look!

@jrobinAV jrobinAV added 📈 Improvement Improvement of a feature. 🖰 GUI Related to GUI 🟨 Priority: Medium Not blocking but should be addressed 🆘 Help wanted Open to participation from the community and removed ✨New feature labels Sep 13, 2024
@jrobinAV jrobinAV added hacktoberfest hacktoberfest issues hacktoberfest - 200💎💎 Issues rewarded by 200 points labels Sep 25, 2024
@HatimZ
Copy link

HatimZ commented Sep 26, 2024

@arcanaxion @jrobinAV I am interested in this issue. Can you please assign this to me?
I think I would need to look deep down into the Markdown module and how it translates string into actual GUI code.
Then i would check for "fc" string and apply styles for width 100% to each child, so they can expand in their axis

@jrobinAV
Copy link
Member

Hello @HatimZ ,

Yep, sure. Let me assign it to you.
If you have any questions, @FredLL-Avaiga @dinhlongviolin1 @namnguyen20999 @FabienLelaquais will be pleased to answer.

@HatimZ
Copy link

HatimZ commented Sep 28, 2024

ok great.

@quest-bot quest-bot bot added the ⚔️ Quest Tracks quest-bot quests label Oct 7, 2024
Copy link

quest-bot bot commented Oct 7, 2024

New Quest! image New Quest!

A new Quest has been launched in @Avaiga’s repo.
Merge a PR that solves this issue to loot the Quest and earn your reward.


Some loot has been stashed in this issue to reward the solver!

🗡 Comment @quest-bot embark to check-in for this Quest and start solving the issue. Other solvers will be notified!

⚔️ When you submit a PR, comment @quest-bot loot #1780 to link your PR to this Quest.

Questions? Check out the docs.

@xyfer17
Copy link

xyfer17 commented Oct 8, 2024

@arcanaxion could please assign the above issue to me, if @HatimZ is not working on it.

@HatimZ
Copy link

HatimZ commented Oct 8, 2024

@arcanaxion Will work on this issue. Just caught up with some work. Updates soon

@HatimZ
Copy link

HatimZ commented Oct 12, 2024

@quest-bot embark

Copy link

quest-bot bot commented Oct 12, 2024

@HatimZ has embarked on their Quest. 🗡

  • @HatimZ has been on GitHub since 2020.
  • They have merged 6 public PRs in that time.
  • Their swords are blessed with Shell and Python magic ✨
  • They haven't contributed to this repo before.

This is not an assignment to the issue. Please check the repo’s contribution guidelines before submitting a PR.

Questions? Check out the docs.

Copy link

quest-bot bot commented Oct 12, 2024

🧚 @HatimZ has submitted PR #2039 and is claiming the loot.

Keep up the pace, or you'll be left in the shadows.

Questions? Check out the docs.

FredLL-Avaiga added a commit to HatimZ/taipy that referenced this issue Oct 22, 2024
FredLL-Avaiga added a commit to HatimZ/taipy that referenced this issue Oct 25, 2024
Copy link
Contributor

This issue has been labelled as "🥶Waiting for contributor" because it has been inactive for more than 14 days. If you would like to continue working on this issue, please add another comment or create a PR that links to this issue. If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. Otherwise, you will be unassigned in 14 days. For more information please refer to the contributing guidelines.

@github-actions github-actions bot added the 🥶Waiting for contributor Issues or PRs waiting for a long time label Oct 27, 2024
FredLL-Avaiga added a commit to HatimZ/taipy that referenced this issue Oct 30, 2024
FredLL-Avaiga added a commit to HatimZ/taipy that referenced this issue Nov 2, 2024
@RymMichaut
Copy link
Member

RymMichaut commented Nov 7, 2024

Congrats @HatimZ
please contact me at [email protected] to ship your swag :)

FredLL-Avaiga added a commit to HatimZ/taipy that referenced this issue Nov 7, 2024
@FredLL-Avaiga
Copy link
Member

FredLL-Avaiga commented Nov 7, 2024

This should be enough for your case @arcanaxion

from taipy.gui import Gui

page = """
<|layout|columns=max-content max-content|

<|card|part|
Metric 1
|>

<|card|part|
Metric 2
|>

|>
"""

if __name__ == "__main__":
    Gui(page).run(title="layout - fit content")

image

What do you think ?

FredLL-Avaiga pushed a commit that referenced this issue Nov 7, 2024
@FredLL-Avaiga FredLL-Avaiga mentioned this issue Nov 7, 2024
5 tasks
@arcanaxion
Copy link
Author

@FredLL-Avaiga Yes that's perfect. Time for me to do some reading on CSS... Thanks Fred!

@github-actions github-actions bot removed the 🥶Waiting for contributor Issues or PRs waiting for a long time label Nov 8, 2024
@FredLL-Avaiga
Copy link
Member

:+1 can you close the issue then?

FredLL-Avaiga added a commit that referenced this issue Nov 8, 2024
* layout fit example
resolves #1780

* Fab's comment

Co-authored-by: Fabien Lelaquais <[email protected]>

* Fab's comment

Co-authored-by: Fabien Lelaquais <[email protected]>

* Fab's comment

---------

Co-authored-by: Fred Lefévère-Laoide <[email protected]>
Co-authored-by: Fabien Lelaquais <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖰 GUI Related to GUI hacktoberfest - 200💎💎 Issues rewarded by 200 points hacktoberfest hacktoberfest issues 🆘 Help wanted Open to participation from the community 📈 Improvement Improvement of a feature. 🟨 Priority: Medium Not blocking but should be addressed ⚔️ Quest Tracks quest-bot quests
Projects
None yet
6 participants