|
| 1 | +/* |
| 2 | + * Story-local styles for the Custom Event playground in Timeline.stories.tsx. |
| 3 | + * |
| 4 | + * The `LeftRailGutter` wrapper reserves horizontal whitespace to the left of the |
| 5 | + * timeline rail so toggling between `actorSize: 'small'` and `actorSize: 'large'` |
| 6 | + * does not horizontally shift the timeline. This mirrors the Rails ViewComponents |
| 7 | + * `.TimelineItem-avatar { position: absolute; left: -72px; }` treatment WITHOUT |
| 8 | + * adding a public avatar slot to Primer React's Timeline component (Phase 2 will |
| 9 | + * evaluate that API change). |
| 10 | + */ |
| 11 | + |
| 12 | +.LeftRailGutter { |
| 13 | + /* Reserve enough room to the left of the rail for a 40px avatar plus a 16px gap. */ |
| 14 | + padding-left: calc(var(--base-size-40) + var(--base-size-16)); |
| 15 | +} |
| 16 | + |
| 17 | +.LargeActorAvatar { |
| 18 | + position: absolute; |
| 19 | + /* Vertically centered with the 32px badge: badge top (16px padding) + 16px half = 32px center; avatar top = 32px - 20px (half avatar) = 12px. */ |
| 20 | + top: var(--base-size-12); |
| 21 | + /* Matches Rails Timeline ViewComponents `.TimelineItem-avatar { left: -72px }`. */ |
| 22 | + left: calc(-1 * (var(--base-size-40) + var(--base-size-32))); |
| 23 | + z-index: 1; |
| 24 | +} |
| 25 | + |
| 26 | +.SmallActorAvatar { |
| 27 | + margin-right: var(--base-size-4); |
| 28 | + /* `vertical-align: middle` is more reliable than `text-bottom` for 20px avatars next |
| 29 | + to body text; the slight negative nudge optically aligns the avatar to the x-height. */ |
| 30 | + vertical-align: middle; |
| 31 | + position: relative; |
| 32 | + /* stylelint-disable-next-line primer/spacing -- 1px optical nudge to align avatar with text x-height */ |
| 33 | + top: -1px; |
| 34 | +} |
| 35 | + |
| 36 | +.ActorName { |
| 37 | + font-weight: var(--base-text-weight-semibold); |
| 38 | + color: var(--fgColor-default); |
| 39 | +} |
| 40 | + |
| 41 | +.AppName { |
| 42 | + font-weight: var(--base-text-weight-semibold); |
| 43 | + color: var(--fgColor-default); |
| 44 | +} |
| 45 | + |
| 46 | +.AppAvatar { |
| 47 | + margin-right: var(--base-size-4); |
| 48 | + vertical-align: middle; |
| 49 | + position: relative; |
| 50 | + /* stylelint-disable-next-line primer/spacing -- 1px optical nudge to align avatar with text x-height */ |
| 51 | + top: -1px; |
| 52 | + border-radius: var(--borderRadius-medium); |
| 53 | +} |
0 commit comments