-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(chips): Initial skeleton/demo. #1855
feat(chips): Initial skeleton/demo. #1855
Conversation
@jelbourn Sorry; I just remembered that we discussed changing this to |
e553b8a
to
6c4d602
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need skeleton for unit tests as well.
|
||
static COMPONENT_CONFIG: Component = { | ||
moduleId: module.id, | ||
selector: 'md-chip-list, [md-chip-list]', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to do the attribute selector until we have a strong use-case for it.
'role': 'listbox', | ||
}, | ||
queries: { | ||
items: new ContentChildren(MdChip) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this specifically (using new
Something in this metadata) won't work in AoT compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will play with this in the AoT and see what happens, but I realized it's actually not used in the skeleton (I built the skeleton by deleting code from what I showed you before) so I will remove it from this PR and probably have it in my next one.
@Component(MdChipList.COMPONENT_CONFIG) | ||
export class MdChipList { | ||
|
||
static COMPONENT_CONFIG: Component = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this does work in AoT mode, then it should just be an exported constant, not a static member on the MdChipList
Either way, though, I'm tempted to say let's not worry about this for the initial version and add a TODO to explore the idea later.
constructor(private _elementRef: ElementRef) {} | ||
|
||
ngAfterContentInit(): void { | ||
this._elementRef.nativeElement.classList.add('md-chips'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to add class
to the host
oject in the component metadata for this:
host: {
'class': 'md-chip-list'
}
Same for chip below.
Component, | ||
ElementRef, | ||
Renderer | ||
} from '@angular/core'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only need to wrap like this if it's longer than 100 cols.
border-radius: $md-chip-horizontal-padding * 2; | ||
|
||
background-color: #E0E0E0; | ||
color: rgba(0, 0, 0, 0.87); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All colors should be in a _chips-theme.scss
file. See the other components for an example.
background-color: #E0E0E0; | ||
color: rgba(0, 0, 0, 0.87); | ||
font-size: 13px; | ||
line-height: 16px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should be setting font-size
and line-height
. Could we use whatever value is current applied on this element?
@hansl thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love some additional guidance on this. Those values were set based off of the spec, so if we are allowing users to deviate, it may change some other values (like the border raidus in particular).
Is there any plan to use em
or rem
instead of pixels?
Also there's a lint error on CI. |
6c4d602
to
df01963
Compare
Create the initial Chips skeleton with a very basic working demo of static, styled chips. References angular#120.
df01963
to
fb22bbe
Compare
@jelbourn Ready for re-review. Made all requested changes except for removing font-size/line-height as I'm not sure what to replace it with. Would love some more feedback on that. |
LGTM |
@kara FYI this will need new build rules. |
|
||
.md-chip { | ||
display: inline-block; | ||
padding: $md-chip-vertical-padding $md-chip-horizontal-padding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to repeat these,
padding: $md-chip-vertical-padding $md-chip-horizontal-padding;
is enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed; will fix in my next PR.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Create the initial Chips skeleton with a very basic working demo of static, styled chips.
References #120.