Skip to content

Commit 9fde521

Browse files
authored
Merge pull request #486 from performant-software/bugfix/cdp165-timeline-styles
Adjust timeline styles (CDP #165)
2 parents 5dd257a + 272b245 commit 9fde521

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/core-data/src/components/FacetTimeline.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ const MAX_MONTH = 2678400000; // 31 days
3030
/**
3131
* Timeline display constants.
3232
*/
33+
// account for difference in font size between storybook and CDP
34+
const ONE_REM = parseFloat(getComputedStyle(document.documentElement).fontSize);
3335
const MARKER_RADIUS = 4; // radius of a circular marker on the timeline
3436
const MARKER_DIAMETER = MARKER_RADIUS * 2;
37+
const MARKER_LINE_OFFSET = 2.25 * ONE_REM; // vertical offset of the marker from the event
3538
const EVENT_LEFT_BORDER = 1; // accounting for the border width
3639
const TIMELINE_PADTOP = 8; // vertical padding between timeline and events
3740
const TIMELINE_HEIGHT = 1; // height of the actual line
@@ -41,8 +44,6 @@ const FRAME_PADDING = 32; // right padding between timeline and frame
4144
/**
4245
* Width/height of a single event in px.
4346
*/
44-
// account for difference in font size between storybook and CDP
45-
const ONE_REM = parseFloat(getComputedStyle(document.documentElement).fontSize);
4647
const EVENT_WIDTH = 11 * ONE_REM; // 11rem
4748
const EVENT_HEIGHT = 2.5 * ONE_REM + TIMELINE_PADTOP; // 2.5rem + timeline padding
4849

@@ -372,7 +373,7 @@ const Timeline = (props: TimelineProps) => {
372373
</Button>
373374
<Button
374375
aria-label={i18n.t('Timeline.zoomOut')}
375-
className={clsx('w-12', 'pl-3', 'border-l-slate-500', props.classNames?.zoom)}
376+
className={clsx('w-12', 'pl-3', props.classNames?.zoom)}
376377
disabled={!canZoomOut}
377378
onClick={onZoomOut}
378379
primary
@@ -399,14 +400,14 @@ const Timeline = (props: TimelineProps) => {
399400
<svg
400401
className={clsx(
401402
'absolute',
402-
'top-[32px]',
403403
)}
404404
height={event.yOffset + TIMELINE_PADTOP + MARKER_DIAMETER}
405405
width={MARKER_DIAMETER}
406406
style={{
407407
left: `${event.anchorRight
408408
? EVENT_WIDTH + EVENT_LEFT_BORDER - MARKER_RADIUS
409409
: -MARKER_RADIUS}px`,
410+
top: MARKER_LINE_OFFSET
410411
}}
411412
>
412413
<line
@@ -715,7 +716,7 @@ const FacetTimeline = (props: Props) => {
715716
]}
716717
classNames={{
717718
...props.classNames,
718-
range: clsx('cursor-grab', 'active:cursor-grabbing', 'bg-slate-500', 'border', 'border-black', props.classNames?.range),
719+
range: clsx('cursor-grab', 'active:cursor-grabbing', 'bg-primary-500', 'border', 'border-black', props.classNames?.range),
719720
root: clsx('ml-14', 'mr-5', props.classNames?.root),
720721
track: clsx('cursor-grab', 'active:cursor-grabbing', 'h-5', 'mb-4', props.classNames?.track),
721722
thumb: clsx('opacity-0', 'w-[1px]', props.classNames?.thumb),

0 commit comments

Comments
 (0)