microsoft / AdaptiveCards

A new way for developers to exchange card content in a common and consistent way.
https://adaptivecards.io
MIT License
1.71k stars 542 forks source link

[Rendering] JS, padding for containers with Default background #6627

Open lynamemi opened 2 years ago

lynamemi commented 2 years ago

Target Platforms

NodeJS

SDK Version

1.3

Application Name

Viva Connections

Problem Description

It seems like a bug, and not by design that containers with Default background color have no padding as containers with any other background color have padding. Can we get padding added for this scenario?

Screenshots

image

Card JSON

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.3",
    "body": [
        {
            "type": "TextBlock",
            "text": "Container properties",
            "wrap": true,
            "horizontalAlignment": "Center",
            "height": "stretch",
            "fontType": "Default",
            "size": "Large",
            "color": "Accent"
        },
        {
            "type": "TextBlock",
            "text": "Style: style",
            "wrap": true,
            "size": "Medium",
            "weight": "Bolder",
            "color": "Accent"
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "(not set)",
                    "wrap": true
                }
            ]
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Default",
                    "wrap": true
                }
            ],
            "style": "default"
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Emphasis",
                    "wrap": true
                }
            ],
            "style": "emphasis"
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Accent",
                    "wrap": true
                }
            ],
            "style": "accent"
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Good",
                    "wrap": true
                }
            ],
            "style": "good"
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Attention",
                    "wrap": true
                }
            ],
            "style": "attention"
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Warning",
                    "wrap": true
                }
            ],
            "style": "warning"
        },
        {
            "type": "TextBlock",
            "text": "---",
            "wrap": true
        },
        {
            "type": "TextBlock",
            "text": "Style: bleed (with style = Accent)",
            "wrap": true,
            "size": "Medium",
            "weight": "Bolder",
            "color": "Accent"
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "False - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                    "wrap": true
                }
            ]
        },
        {
            "type": "Container",
            "bleed": true,
            "items": [
                {
                    "type": "TextBlock",
                    "text": "True - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                    "wrap": true
                }
            ],
            "style": "accent"
        },
        {
            "type": "TextBlock",
            "text": "---",
            "wrap": true
        },
        {
            "type": "TextBlock",
            "text": "Background image: fillMode  (URL set)",
            "wrap": true,
            "size": "Medium",
            "weight": "Bolder",
            "color": "Accent"
        },
        {
            "type": "TextBlock",
            "text": "Cover",
            "wrap": true
        },
        {
            "type": "Container",
            "backgroundImage": {
                "url": "https://microsoft.sharepoint-df.com/teams/MEEDemo/SiteAssets/Dashboard/tree-small.jpeg"
            },
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                    "wrap": true
                }
            ],
            "bleed": true
        },
        {
            "type": "TextBlock",
            "text": "RepeatHorizontally",
            "wrap": true
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                    "wrap": true
                }
            ],
            "backgroundImage": {
                "url": "https://microsoft.sharepoint-df.com/teams/MEEDemo/SiteAssets/Dashboard/tree-small.jpeg",
                "fillMode": "RepeatHorizontally"
            }
        },
        {
            "type": "TextBlock",
            "text": "RepeatVertically",
            "wrap": true
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                    "wrap": true
                }
            ],
            "backgroundImage": {
                "url": "https://microsoft.sharepoint-df.com/teams/MEEDemo/SiteAssets/Dashboard/tree-small.jpeg",
                "fillMode": "RepeatVertically"
            }
        },
        {
            "type": "TextBlock",
            "text": "Repeat",
            "wrap": true
        },
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                    "wrap": true
                }
            ],
            "backgroundImage": {
                "url": "https://microsoft.sharepoint-df.com/teams/MEEDemo/SiteAssets/Dashboard/tree-small.jpeg",
                "fillMode": "Repeat"
            }
        },
        {
            "type": "TextBlock",
            "text": "---",
            "wrap": true
        }
    ],
    "backgroundImage": {
        "horizontalAlignment": "Center"
    },
    "minHeight": "0px"
}

Sample Code Language

No response

Sample Code

No response

paulcam206 commented 2 years ago

I'll take a look at this -- we need to see if this behavior is matched on other platforms. This may have been an explicit design decision, but it would have been made before I joined the team, so I'm missing some context.

jwoo-msft commented 2 years ago

@lynamemi this is by design. Padding only get added if parent container view's style is different from child's style. parent's style will be default by default. and setting child's style default will create no padding.

one option you can consider is setting one of style's background color to default's color in host config. suppose default's color is blue. then set accent's color to blue. and use accent in place of default for styling.