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

prototype(card): create prototype card based on MDC web #16588

Merged
merged 1 commit into from
Aug 22, 2019

Conversation

jelbourn
Copy link
Member

No description provided.

@jelbourn jelbourn added pr: merge safe target: patch This PR is targeted for the next patch release labels Jul 23, 2019
@jelbourn jelbourn requested review from crisbeto and mmalerba July 23, 2019 19:37
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 23, 2019
@jelbourn jelbourn force-pushed the mdc-card branch 6 times, most recently from 3d1d60f to e8a3330 Compare July 23, 2019 22:49
deps = [
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material/core:all_themes",
Copy link
Member

Choose a reason for hiding this comment

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

why do we bring in the whole theme here? shouldn't we just fine-grain what is used?

This generally causes unnecessary rebuilds if unrelated things change and the Sass compilation is not very fast right now (it's a bottleneck)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, I just copy-pasted from the checkbox without thinking about it. It's actually not necessary at all.

// the title, and add a margin bottom to create space underneath the header.
.mat-mdc-card-subtitle {
margin-top: -8px;
margin-bottom: 16px;
Copy link
Member

Choose a reason for hiding this comment

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

Just asking out of curiosity: can't we calculate this somehow through variables? (it feels a bit like magic numbers to me)

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to use $mat-card-default-padding

}

// When the card actions come after the footer, eliminate the action's bottom padding because
// it's caputred by the footer.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// it's caputred by the footer.
// it's captured by the footer.

Copy link
Member

@devversion devversion Jul 24, 2019

Choose a reason for hiding this comment

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

Also can you explain what is happening here? I'm confused by the comment that says that the footer captures the bottom padding of the actions? how can that work if the footer is an element before the actions?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, this makes no sense. Removed.

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, a few minor nits are left.

width: $mat-card-header-size;
border-radius: 50%;
flex-shrink: 0;

Copy link
Member

Choose a reason for hiding this comment

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

Does this also need a background-position: center.

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 current mat-card-avatar doesn't have it, so I'm just leaving it the same

// When both a title and a subtitle are used, eliminate the top padding of whichever comes second
// because the first already covers the padding.
.mat-mdc-card-subtitle ~ .mat-mdc-card-title,
.mat-mdc-card-title ~ .mat-mdc-card-subtitle {
Copy link
Member

Choose a reason for hiding this comment

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

You could potentially combine it with the declaration above since it's declaring the same styles.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, though it does make the source less pretty since you have to expand the nesting.

@@ -114,7 +114,7 @@ $mat-typography-level-mappings: (
$primary: mat-color(map-get($theme, primary));
$accent: mat-color(map-get($theme, accent));
$warn: mat-color(map-get($theme, warn));
$background: mat-color(map-get($theme, background), background);
$backgroundPalette: map-get($theme, background);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be dash-cased?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, done.


@NgModule({
imports: [MatCommonModule, CommonModule],
exports: [MatCard, MatCommonModule],
declarations: [MatCard],
exports: CARD_DIRECTIVES,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need to export MatCommonModule?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good catch

Copy link
Member Author

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

Addressed last comment. Should be ready to go

// When both a title and a subtitle are used, eliminate the top padding of whichever comes second
// because the first already covers the padding.
.mat-mdc-card-subtitle ~ .mat-mdc-card-title,
.mat-mdc-card-title ~ .mat-mdc-card-subtitle {
Copy link
Member Author

Choose a reason for hiding this comment

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

Done, though it does make the source less pretty since you have to expand the nesting.

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

@crisbeto crisbeto added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Aug 22, 2019
@jelbourn jelbourn merged commit f6116ee into angular:master Aug 22, 2019
andrewseguin pushed a commit that referenced this pull request Aug 26, 2019
@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 Sep 22, 2019
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 target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants