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(material-experimental/mdc-dialog): switch to new theming api #23620

Merged
merged 1 commit into from
Mar 2, 2022

Conversation

andrewseguin
Copy link
Contributor

Applied the values for the theming by isolating the theme color/typography styles included in the current mixin. Should match the existing styles, and I'll run an internal presubmit to double-check this is a no-op

@andrewseguin andrewseguin added P2 The issue is important to a large percentage of users, with a workaround target: patch This PR is targeted for the next patch release labels Sep 22, 2021
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Sep 22, 2021
// Theme map with values for variables that will be overriden in the theme.
// MDC's theming system requires non-null values for the slots to be inserted
// and included as default values.
$dialog-initial-theme: (
Copy link
Member

Choose a reason for hiding this comment

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

Do we actually need this? For the other components MDC provided a $light-theme with some default values that I used outside for the theme-styles mixin.

Copy link
Member

Choose a reason for hiding this comment

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

Also if we do end up keeping this variable, the name should be with an underscore so that it isn't exported by Sass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately yes - their variable contains the keys but with null values, which means their theme mixin skips inserting the slots. They plan to eventually provide a variable with filled values, but not until at least a couple quarters from now.

Changed variable name to underscore-prefix - thanks for catching that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's their variable definition - https://github.com/material-components/material-components-web/blob/master/packages/mdc-dialog/_dialog-theme.scss#L36

They say that null (or any other falsy) values don't insert slots for backwards compatibility reasons. I wish that wasn't the case

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, that is unfortunate and a little fragile since we won't have a way of knowing when they introduce a new variable.

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

LGTM

// Theme map with values for variables that will be overriden in the theme.
// MDC's theming system requires non-null values for the slots to be inserted
// and included as default values.
$_dialog-initial-theme: (
Copy link
Member

Choose a reason for hiding this comment

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

How much of this can we extract into a common location shared between multiple components? E.g. container-color and supporting-text-color seem like they'd be the common surface and on-surface colors for a lot of components.

@andrewseguin andrewseguin removed the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 28, 2021
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 29, 2021
@andrewseguin andrewseguin added the action: merge The PR is ready for merge by the caretaker label Feb 2, 2022
@andrewseguin andrewseguin added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Mar 2, 2022
@andrewseguin andrewseguin merged commit 353a548 into angular:master Mar 2, 2022
andrewseguin added a commit to andrewseguin/components that referenced this pull request Mar 2, 2022
andrewseguin added a commit that referenced this pull request Mar 2, 2022
andrewseguin added a commit to andrewseguin/components that referenced this pull request Mar 4, 2022
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P2 The issue is important to a large percentage of users, with a workaround target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants