Skip to content

Commit

Permalink
fixup! feat(Timeline): Migrate to styled-components
Browse files Browse the repository at this point in the history
  • Loading branch information
m7kvqbe1 committed Sep 23, 2020
1 parent fbb3903 commit 29211b8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 24 deletions.
40 changes: 20 additions & 20 deletions packages/css-framework/src/components/_timeline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,30 @@ $timeline-row-header-width: 16rem;
}
}

.timeline__navigation {
position: absolute;
top: 1rem;
left: 1rem;
// .timeline__navigation {
// position: absolute;
// top: 1rem;
// left: 1rem;

button {
&:first-of-type {
margin-right: f.spacing("4");
}
// button {
// &:first-of-type {
// margin-right: f.spacing("4");
// }

span:first-of-type {
display: none;
}
// span:first-of-type {
// display: none;
// }

.rn-btn__icon {
margin-left: 0;
}
}
}
// .rn-btn__icon {
// margin-left: 0;
// }
// }
// }

.timeline__months,
.timeline__months--renderDefault {
white-space: nowrap;
}
// .timeline__months,
// .timeline__months--renderDefault {
// white-space: nowrap;
// }

// .timeline__month--renderDefault {
// position: relative;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react'
import { IconChevronRight, IconChevronLeft } from '@royalnavy/icon-library'
import styled from 'styled-components'
import { Spacing4 } from '@royalnavy/design-tokens'

import { ComponentWithClass } from '../../common/ComponentWithClass'
import { getKey } from '../../helpers'
Expand Down Expand Up @@ -27,6 +29,30 @@ export type TimelineMonthsProps =
| TimelineMonthsWithRenderContentProps
| TimelineMonthsWithChildrenProps

const Navigation = styled.div`
position: absolute;
top: 1rem;
left: 1rem;
button {
&:first-of-type {
margin-right: ${Spacing4};
}
span:first-of-type {
display: none;
}
.rn-btn__icon {
margin-left: 0;
}
}
`

const StyledTimelineMonths = styled.div`
white-space: nowrap;
`

export const TimelineMonths: React.FC<TimelineMonthsProps> = ({ render }) => (
<TimelineContext.Consumer>
{({
Expand All @@ -42,7 +68,7 @@ export const TimelineMonths: React.FC<TimelineMonthsProps> = ({ render }) => (
name="Months"
renderRowHeader={(name) => (
<>
<div
<Navigation
className="timeline__navigation"
data-testid="timeline-navigation"
>
Expand All @@ -60,12 +86,12 @@ export const TimelineMonths: React.FC<TimelineMonthsProps> = ({ render }) => (
onClick={(_) => dispatch({ type: TIMELINE_ACTIONS.GET_NEXT })}
data-testid="timeline-side-button-right"
/>
</div>
</Navigation>
{name}
</>
)}
>
<div className="timeline__months">
<StyledTimelineMonths>
{months.map(({ startDate }, index) => (
<TimelineMonth
days={days}
Expand All @@ -76,7 +102,7 @@ export const TimelineMonths: React.FC<TimelineMonthsProps> = ({ render }) => (
startDate={startDate}
/>
))}
</div>
</StyledTimelineMonths>
</TimelineHeaderRow>
)}
</TimelineContext.Consumer>
Expand Down

0 comments on commit 29211b8

Please sign in to comment.