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

Timeline - Option to override the row styling (not just header) #1998

Closed
s24y85u2 opened this issue Feb 10, 2021 · 1 comment · Fixed by #2069
Closed

Timeline - Option to override the row styling (not just header) #1998

s24y85u2 opened this issue Feb 10, 2021 · 1 comment · Fixed by #2069
Assignees
Labels
Package: react-component-library Package/code type Type: Enhancement New feature or request

Comments

@s24y85u2
Copy link

Description

On Timeline component:

https://storybook.royalnavy.io/?path=/story/timeline--with-custom-event-content

We would like to see guidelines of the rows in the timeline, so a thin border around the rows essentially. We currently only have the ability to provide a function to renderRowHeader but would be great if there was a way we could put these guidelines onto the whole row somehow.

@thyhjwb6
Copy link
Collaborator

Does this help?

const StyledTimelineRow = styled(TimelineRow)`
  height: 60px;
  ${StyledRowHeader} {
    background-color: lightcoral;
  }

  ${StyledRowContent} {
    background-color: lightblue;
  }
`

And then:

  <Timeline
    hasSide
    startDate={new Date(2020, 3, 1)}
    today={new Date(2020, 3, 15)}
  >
    <TimelineTodayMarker />
    <TimelineMonths />
    <TimelineWeeks />
    <TimelineDays />
    <TimelineRows>
      <StyledTimelineRow name="Row 1" renderRowHeader={() => <span>row header2</span>}>
        <TimelineEvents>
          <TimelineEvent
            startDate={new Date(2020, 2, 14)}
            endDate={new Date(2020, 3, 18)}
          >
            Event 1
          </TimelineEvent>
        </TimelineEvents>
      </StyledTimelineRow>
    </TimelineRows>
  </Timeline>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: react-component-library Package/code type Type: Enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants