UNPKG

@primer/components

Version:
62 lines (59 loc) 3.22 kB
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import classnames from 'classnames'; import React from 'react'; import styled, { css } from 'styled-components'; import Box from './Box'; import { COMMON, get } from './constants'; import sx from './sx'; const Timeline = styled(Box).withConfig({ displayName: "Timeline", componentId: "c4dq2e-0" })(["display:flex;flex-direction:column;", " ", ";"], props => props.clipSidebar && css([".Timeline-Item:first-child{padding-top:0;}.Timeline-Item:last-child{padding-bottom:0;}"]), sx); const TimelineItem = styled(Box).attrs(props => ({ className: classnames('Timeline-Item', props.className) })).withConfig({ displayName: "Timeline__TimelineItem", componentId: "c4dq2e-1" })(["display:flex;position:relative;padding:", " 0;margin-left:", ";&::before{position:absolute;top:0;bottom:0;left:0;display:block;width:2px;content:'';background-color:", ";}", " ", ";", ";"], get('space.3'), get('space.3'), get('colors.border.muted'), props => props.condensed && css(["padding-top:", ";padding-bottom:0;&:last-child{padding-bottom:", ";}.TimelineItem-Badge{height:16px;margin-top:", ";margin-bottom:", ";color:", ";background-color:", ";border:0;}"], get('space.1'), get('space.3'), get('space.2'), get('space.2'), get('colors.fg.muted'), get('colors.canvas.default')), COMMON, sx); const TimelineBadge = props => { return /*#__PURE__*/React.createElement(Box, { position: "relative", zIndex: 1 }, /*#__PURE__*/React.createElement(Box, _extends({ display: "flex", className: classnames(props.className, 'TimelineItem-Badge'), flexShrink: 0, borderRadius: "50%", borderWidth: "2px", borderStyle: "solid", borderColor: "canvas.default", overflow: "hidden", color: "fg.muted", bg: "timeline.badgeBg", width: "32px", height: "32px", mr: 2, ml: "-15px", alignItems: "center", justifyContent: "center" }, props), props.children)); }; TimelineBadge.displayName = "TimelineBadge"; const TimelineBody = styled(Box).withConfig({ displayName: "Timeline__TimelineBody", componentId: "c4dq2e-2" })(["min-width:0;max-width:100%;margin-top:", ";color:", ";flex:auto;font-size:", ";", ";"], get('space.1'), get('colors.fg.muted'), get('fontSizes.1'), sx); const TimelineBreak = styled(Box).withConfig({ displayName: "Timeline__TimelineBreak", componentId: "c4dq2e-3" })(["position:relative z-index:1;height:24px;margin:0;margin-bottom:-", ";margin-left:0;background-color:", ";border:0;border-top:", " solid ", ";", ";"], get('space.3'), get('colors.canvas.default'), get('space.1'), get('colors.border.default'), sx); TimelineItem.displayName = 'Timeline.Item'; TimelineBadge.displayName = 'Timeline.Badge'; TimelineBody.displayName = 'Timeline.Body'; TimelineBreak.displayName = 'Timeline.Break'; export default Object.assign(Timeline, { Item: TimelineItem, Badge: TimelineBadge, Body: TimelineBody, Break: TimelineBreak });