Skip to content

Add <List> component #23

@haydn

Description

@haydn

Objective

Add <List> and <ListItem> components:

const List = ({ children, format }) => (
  <Stack
    indent
    style={{
      listStyleType: format === "ordered" ? "decimal" : format === "unordered" ? "bullet" : null,
    }}
    tagName={format === "ordered" ? "ol" : "ul"}
  >
    {children}
  </Stack>
);

const ListItem = ({ children }) => <li style={{ listStyleType: "inherit" }}>{children}</li>;

Rationale

This makes it cleaner/easier to put together simple lists:

<List ordered>
  <ListItem>This is an item.</ListItem>
</List>

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