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: Implement compact attribute for markup card #1937

Merged
merged 2 commits into from Apr 17, 2023

Conversation

dthiagarajan7
Copy link
Contributor

@dthiagarajan7 dthiagarajan7 commented Apr 17, 2023

Github Issue

Closes #1922

Description

Added a compact attribute to the State interface of markup.tsx. Users can now specify whether they want the markup card to include the paddings or not. compact attribute defaults to False.

Succssful Local Testing

Screen Shot 2023-04-17 at 9 28 29 AM

Differences between compact invocations are depicted above.

The code used to produce the markup cards above is included below.

menu = '''
<p>
    <span>Spam</span>
    <span>Ham</span>
    <span>Eggs</span>
</p>
'''

# Markup card with default padding (compact attribute not invoked)
page['example1'] = ui.markup_card(
    box='4 1 3 2',
    title='Markup card with default padding (compact attribute not invoked)',
    content=menu,
)

# Markup card with padding (compact=False)
page['example2'] = ui.markup_card(
    box='4 3 3 2',
    title='Markup card with padding (compact=False)',
    content=menu,
    compact=False
)

# Markup card with no padding (compact=True)
page['example3'] = ui.markup_card(
    box='4 5 3 2',
    title='Markup card with no padding (compact=True)',
    content=menu,
    compact=True
)

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 @dthiagarajan7! A few small changes necessary.

website/widgets/content/markup.md Outdated Show resolved Hide resolved
website/widgets/content/markup.md Outdated Show resolved Hide resolved
ui/src/markup.tsx Outdated Show resolved Hide resolved
ui/src/markup.tsx Outdated Show resolved Hide resolved
website/widgets/content/markup.md Outdated Show resolved Hide resolved
@dthiagarajan7
Copy link
Contributor Author

@mturoci Thanks for the suggestions! I've just pushed all of the requested revisions and have updated the PR description accordingly.

@mturoci
Copy link
Collaborator

mturoci commented Apr 17, 2023

Seems like your branch needs to be rebased against the latest master. Please make sure the PR branch only includes changes relevant to the corresponding issue.

@dthiagarajan7
Copy link
Contributor Author

@mturoci I'm so sorry about that! I've trimmed the PR branch to include only the relevant changes.

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 perfect now @dthiagarajan7!

@mturoci mturoci merged commit 693f23d into h2oai:master Apr 17, 2023
2 checks passed
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.

Implement compact attribute for markup card
2 participants