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

Adding styling #7

Open
Lilish-Warrior opened this issue Jun 7, 2022 · 0 comments
Open

Adding styling #7

Lilish-Warrior opened this issue Jun 7, 2022 · 0 comments

Comments

@Lilish-Warrior
Copy link

Hi,

I'm learning to create components and as I followed this tutorial I'm having issues implementing any styles into the component.
Can you help me know what I'm missing?

my-component.css

:host {
  display: block;
};


.color {
  background-color: red;
}

my-component.tsx

import { Component, Prop, h } from '@stencil/core';
import { format } from '../../utils/utils';

@Component({
  tag: 'my-component',
  styleUrl: 'my-component.css',
  shadow: true,
})
export class MyComponent {
 
  @Prop() first: string;
  @Prop() middle: string;
  @Prop() last: string;

  private getText(): string {
    return format(this.first, this.middle, this.last);
  }

  render() {
    return <div class='color'>
      Hello, World! I'm {this.getText()} 
      </div>;
  }
}

Is this where I should be adding the color class? Or should it be in my-component.stories.ts as part of the args?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant