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

[JS] textStyles support and final heading level model #5698

Merged
merged 5 commits into from
Apr 21, 2021
Merged

Conversation

dclaux
Copy link
Member

@dclaux dclaux commented Apr 20, 2021

Related Issue

Fixes #5635

Description

Please refer to the spec for details as to what this PR implements.

Samples

Card

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5",
    "body": [
        {
            "type": "TextBlock",
            "text": "This TextBlock has all its style-related properties unset",
            "wrap": true
        },
        {
            "type": "TextBlock",
            "text": "This TextBlock has the \"heading\" style without overrides",
            "wrap": true,
            "style": "heading"
        },
        {
            "type": "TextBlock",
            "text": "This TextBlock has the \"heading\" style and overrides **fontType** and **color**",
            "wrap": true,
            "style": "heading",
            "color": "Accent",
            "fontType": "Monospace"
        }
    ]
}

As rendered:
image

Accessibility:
image

HostConfig

{
    ...
    "textStyles": {
        "heading": {
            "fontType": "default",
            "size": "large",
            "weight": "bolder",
            "color": "default",
            "isSubtle": false
        }
    },
    "textBlock": {
        "headingLevel": 2
    }
    ...
}

How Verified

Verified manually in adaptivecards-designer-app

Microsoft Reviewers: Open in CodeFlow

@ghost
Copy link

ghost commented Apr 20, 2021

Hi @dclaux. Thanks for helping make the AdaptiveCards JS renderer + tooling better. As additional verification, once the JS build succeeds, please go to the test site to test out your website/designer changes.

}
},
"textBlock": {
"headingLevel": 2
Copy link
Member

Choose a reason for hiding this comment

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

One of these affects the samples on our site, right? Should we leave that one unset, or is 2 the right level?

Copy link
Member Author

Choose a reason for hiding this comment

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

The site would likely need level 3 as the default. But if it does need that, I think it should have its own HostConfig.

@@ -489,12 +489,35 @@ export interface IVersionedChoice {
value: string;
}

const NotSetValue = "@@not_set@@";
Copy link
Member

Choose a reason for hiding this comment

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

Is this because Adaptive.Choice doesn't accept null/undefined as a value?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's because the HTML tag doesn't.

source/nodejs/adaptivecards-designer/src/designer-peers.ts Outdated Show resolved Hide resolved
@jonmill
Copy link
Contributor

jonmill commented Apr 20, 2021

LGTM, thanks David!

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.

[JS] Add heading styling support to renderer
3 participants