Skip to content

Decide on JS conventions for "child" components #166

Description

@shawnbot

We've currently got a couple of instances of BEM-style block and element component classes that live in separate files:

  • FlexContainer and FlexItem
  • UnderlineNav and UnderlineNavLink

@broccolini and I chatted about this briefly yesterday and the idea of colocating them came up, which would change this:

import {FlexContainer, FlexItem} from 'primer-react'
export default () => (
  <FlexContainer>
    <FlexItem>Hello</FlexItem>
    <FlexItem>World</FlexItem>
  </FlexContainer>
)

to:

import {Flex} from 'primer-react'
export default () => (
  <Flex>
    <Flex.Item>Hello</Flex.Item>
    <Flex.Item>World</Flex.Item>
  </Flex>
)

and this:

import {UnderlineNav, UnderlineNavLink} from 'primer-react'
export default () => (
  <UnderlineNav>
    <UnderlineNavLink href="/">Home</UnderlineNavLink>
    <UnderlineNavLink href="/about/">About</UnderlineNavLink>
  </UnderlineNav>
)

to:

import {UnderlineNav} from 'primer-react'
export default () => (
  <UnderlineNav>
    <UnderlineNav.Link href="/">Home</UnderlineNav.Link>
    <UnderlineNav.Link href="/about/">About</UnderlineNav.Link>
  </UnderlineNav>
)

Let's decide whether we want to do this and maybe include our reasoning in our design principles? /cc #50

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions