Skip to content

Add --as-prop (--as-arg) flag #92

Open

Description

@softmarshmallow

--as-prop Flag proposal

--as-prop
--as-arg
--max-width-as-prop=300
--max-width=300 --as-prop

Usage
while specifying a dedicated value to a property, e.g. a max-width, we can add extra --as-prop flag to make it as a externally configurable property. which as a result, will generate the code below.

function Component ({maxWidth = 300}:{maxWidth: number}){
    ...
        <Container maxWidth={maxWidth}>
        </Container>
    ...
}

const Container = styled.div<{maxWidth: number}>`
    ...
    max-width: ${p => p.maxWidth}px
    ...
`;

Activity

  1. changed the title [-]Add --as-prop (--as-arg) flag[/-] [+]Add `--as-prop` (`--as-arg`) flag[/+] on Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions