GithubHelp home page GithubHelp logo

fifthbeat / styled-stencils Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 1.0 338 KB

A styled-component like library for StencilJS

License: GNU General Public License v3.0

JavaScript 100.00%
css stenciljs styled-components styling styling-css-in-js web-components

styled-stencils's People

Contributors

dependabot[bot] avatar wanbinkimoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mehmetsuci

styled-stencils's Issues

Information: apply display flex

I'm using display: flex and appear not apply on elements.

Code example

const StyledIcon = styled.span`
  display: flex;
`;

Using div or span whethever, the result is the same.

My component

    return (
      <Host>
        <StyledIcon>
          <div>Column 1</div>
          <div>Column 2</div>
        </StyledIcon>
      </Host>
    );

Preview

image

For tests, adding display: flex; on dynamic created element

image

`as` Prop doesn't work

Hi! I'm trying to use as Prop -> documentation here <- but it doesn't work.

I have this StyledComponent:

export const Text = styled.div`
    color: #333333;
    font-size: 1.5rem;
`;
export class TheText {
	@Prop() text: string;
	@Prop() taghtml: string;

	render() {
		return (
			<Host>
				<Text as={this.taghtml}>{this.text}</Text>
			</Host>
		);
	}
}

I use TheText component:

<the-text text="Hi! I'm a text" taghtml="p"/>

And the DOM always show the tag: div

<the-text text="Hi! I'm a text" taghtml="p">
	<div>Hi! I'm a text</div>
</the-text>

Cannot pass props to styled component

While trying to create a button, I discovered that the following code won't render props to the styled component.

Stripped back code:

const Button = styled.button`
...
`

@Component({
	tag: 'my-button'
})

export class MyButton {
   @Prop() isDisabled?: boolean;
   
   render () {
      return (
         <Button disabled={this.isDisabled}></Button>
      )}
}

<my-button is-disabled></my-button>

When rendering the component, the attribute disabled isn't rendered on the element. On the host the is-disabled prop is visible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.