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

feat: Allow users to remove paddings on frame cards #1735

Merged
merged 6 commits into from
Dec 9, 2022

Conversation

kitty3190
Copy link
Contributor

@kitty3190 kitty3190 commented Dec 5, 2022

Added a parameter called compact in the State interface of frame.tsx. Users can specify whether they want the frame cards to have title and paddings or not. compact defaults to False.

Example:
Screenshot 2022-12-07 at 12 56 00
Frame card with no padding specified:
Screenshot 2022-12-07 at 12 56 13

The changes are reflected above. The first frame card with default padding (compact not specified), the second frame card with padding specified, and the third frame card with no padding specified.

The code used for testing the changes above:

# Frame card with default padding
page['example1'] = ui.frame_card(
    box='1 1 -1 4',
    title='Frame card with default padding',
    path='https://example.com',
)

# Frame card with padding
page['example2'] = ui.frame_card(
    box='1 5 -1 4',
    title='Frame card with padding specified',
    path='https://example.com',
    compact=False
)

# Frame card with no padding
page['example3'] = ui.frame_card(
    box='1 9 -1 4',
    title='Frame card with no padding specified',
    path='https://example.com',
    compact=True
)

This pull request closes #495.

Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kitty3190!

Based on your screenshots, it seems like it might be a good idea to also not display the title (even if specified) if the padding is turned off. This way, the whole frame card should be occupied purely with the content (be it an HTML or 3rd party site link).

Make sure to reflect the above in docstrings as well.

ui/src/frame.tsx Outdated Show resolved Hide resolved
@kitty3190
Copy link
Contributor Author

kitty3190 commented Dec 7, 2022

Thanks for the review @mturoci! I addressed the issues in my latest commit and updated the documentation above in the PR description.

@kitty3190 kitty3190 changed the title feat: Allow users to remove paddings on frame cards. feat: Allow users to remove paddings on frame cards Dec 7, 2022
Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. I forgot the docs last time. Can you please add this to both frame.md files? Once done, it's good to be merged.

ui/src/frame.tsx Outdated Show resolved Hide resolved
kitty3190 and others added 2 commits December 8, 2022 16:28
Co-authored-by: mturoci <64769322+mturoci@users.noreply.github.com>
@kitty3190
Copy link
Contributor Author

Thanks @mturoci! I've added documentation in the frame.md file inside the content folder which relates to ui.frame_card in my latest commit. I believe the other frame.md file in the form folder relates to ui.frame which I did not modify. Let me know if additional changes are required!

lo5
lo5 previously approved these changes Dec 9, 2022
@mturoci mturoci merged commit 2b16927 into h2oai:master Dec 9, 2022
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

Successfully merging this pull request may close these issues.

Allow frame cards to be displayed without margin/padding
3 participants