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(logo-grid): web component created #4287

Merged
merged 24 commits into from
Oct 30, 2020
Merged

feat(logo-grid): web component created #4287

merged 24 commits into from
Oct 30, 2020

Conversation

raphaelamadeu-zz
Copy link
Contributor

Related Ticket(s)

#3780

Description

Web component version created after the react component.

@raphaelamadeu-zz raphaelamadeu-zz added the package: web components Work necessary for the IBM.com Library web components package label Oct 22, 2020
@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Oct 22, 2020

@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Oct 22, 2020

Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

Good to see you keep creating new components @raphaelamadeu!

@@ -83,7 +84,9 @@
}
}

.#{$prefix}--logo-grid__container {
.#{$prefix}--logo-grid__container,
:host(#{$dds-prefix}-logo-grid):not(.#{$prefix}--logo-grid__no-border)
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use CSS classes on our own Web Components, given it tends to clash with CSS classes application code sets:

Suggested change
:host(#{$dds-prefix}-logo-grid):not(.#{$prefix}--logo-grid__no-border)
:host(#{$dds-prefix}-logo-grid):not([hide-border])

@@ -0,0 +1,22 @@
{
"name": "ibmdotcom-web-components-quote-example",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"name": "ibmdotcom-web-components-quote-example",
"name": "ibmdotcom-web-components-logo-grid-example",

Comment on lines 38 to 40
protected updated() {
this.classList.toggle((this.constructor as typeof DDSLogoGrid).hideBorderClass, this.hideBorder);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use CSS classes on our own Web Components, given it tends to clash with CSS classes application code sets. We use attribute selectors instead:

Suggested change
protected updated() {
this.classList.toggle((this.constructor as typeof DDSLogoGrid).hideBorderClass, this.hideBorder);
}

Comment on lines 31 to 33
static get hideBorderClass() {
return `${prefix}--logo-grid__no-border`;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use CSS classes on our own Web Components, given it tends to clash with CSS classes application code sets. We use attribute selectors instead:

Suggested change
static get hideBorderClass() {
return `${prefix}--logo-grid__no-border`;
}

Comment on lines 26 to 62
class DDSLogoGrid extends StableSelectorMixin(DDSContentBlock) {
static get stableSelector() {
return `${ddsPrefix}--logo-grid`;
}

static get hideBorderClass() {
return `${prefix}--logo-grid__no-border`;
}

@property({ attribute: 'hide-border', reflect: true, type: Boolean })
hideBorder = false;

protected updated() {
this.classList.toggle((this.constructor as typeof DDSLogoGrid).hideBorderClass, this.hideBorder);
}

// eslint-disable-next-line class-methods-use-this
protected _renderContent() {
return html`
<div class="bx--content-block__children">
<div class="bx--logo-grid__row">
<slot></slot>
</div>
</div>
`;
}

// eslint-disable-next-line class-methods-use-this
protected _renderCopy() {
return '';
}

// `styles` here is a `CSSResult` generated by custom WebPack loader
static get styles() {
return css`${super.styles}${styles}`;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick for aligning with other classes in the codebase: Could you please re-group properties/methods, in the following order?

  1. Protected methods
  2. Public properties
  3. Static properties

Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

Thank you for the update @raphaelamadeu!

Comment on lines 28 to 30
protected updated() {
this.classList.toggle((this.constructor as typeof DDSLogoGrid).hideBorderClass, this.hideBorder);
this.toggleAttribute('hide-border', this.hideBorder);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@property({ attribute: 'hide-border', reflect: true, type: Boolean }) takes care of this automatically.

Suggested change
protected updated() {
this.classList.toggle((this.constructor as typeof DDSLogoGrid).hideBorderClass, this.hideBorder);
this.toggleAttribute('hide-border', this.hideBorder);
}

Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

Thanks @raphaelamadeu for the updates!

* LICENSE file in the root directory of this source tree.
*/
import { customElement, html, property } from 'lit-element';
// import settings from 'carbon-components/es/globals/js/settings';
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to remove this line?

import DDSImage from '../image/image';
import StableSelectorMixin from '../../globals/mixins/stable-selector';

// const { prefix } = settings;
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to remove this line?

Comment on lines 28 to 30
protected updated() {
this.toggleAttribute('hide-border', this.hideBorder);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@property({ attribute: 'hide-border', reflect: true, type: Boolean }) takes care of this automatically.

Suggested change
protected updated() {
this.toggleAttribute('hide-border', this.hideBorder);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

@raphaelamadeu Have you tried to removing this method? Thanks!

Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

LGTM 👍 - Thanks @raphaelamadeu for all the updates!

@jeffchew
Copy link
Member

@raphaelamadeu for the documentation, can you provide some more details of what the complementaryStyleScheme is, and what other options there are other than regular?

@jeffchew
Copy link
Member

@raphaelamadeu can you add stable selectors?

@raphaelamadeu-zz raphaelamadeu-zz merged commit 4620b58 into carbon-design-system:master Oct 30, 2020
raphaelamadeu-zz added a commit that referenced this pull request Oct 30, 2020
@raphaelamadeu-zz raphaelamadeu-zz deleted the web-component/logo-grid branch October 30, 2020 17:11
@raphaelamadeu-zz raphaelamadeu-zz restored the web-component/logo-grid branch October 30, 2020 17:11
kodiakhq bot pushed a commit that referenced this pull request Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: web components Work necessary for the IBM.com Library web components package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants