From c1986cd415c81711fdef3315596c90a2740ca179 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Mon, 13 May 2024 00:05:27 +0300 Subject: [PATCH] Tokens for Timeline --- components/lib/themes/aura/timeline/index.js | 26 ++++++++++++-- components/lib/themes/lara/timeline/index.js | 28 +++++++++++++-- .../lib/timeline/style/TimelineStyle.js | 36 +++++++++---------- 3 files changed, 67 insertions(+), 23 deletions(-) diff --git a/components/lib/themes/aura/timeline/index.js b/components/lib/themes/aura/timeline/index.js index 16f32a615..9058486e5 100644 --- a/components/lib/themes/aura/timeline/index.js +++ b/components/lib/themes/aura/timeline/index.js @@ -1,10 +1,32 @@ export default { + event: { + minHeight: '5rem' + }, + horizontal: { + eventContent: { + padding: '1rem 0' + } + }, + vertical: { + eventContent: { + padding: '0 1rem' + } + }, eventMarker: { + size: '1.125rem', + borderRadius: '50%', + borderWidth: '2px', background: '{content.background}', borderColor: '{content.border.color}', - contentColor: '{primary.color}' + content: { + borderRadius: '50%', + size: '0.375rem', + background: '{primary.color}', + insetShadow: '0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)' + } }, eventConnector: { - color: '{content.border.color}' + color: '{content.border.color}', + size: '2px' } }; diff --git a/components/lib/themes/lara/timeline/index.js b/components/lib/themes/lara/timeline/index.js index 16f32a615..386e09fa0 100644 --- a/components/lib/themes/lara/timeline/index.js +++ b/components/lib/themes/lara/timeline/index.js @@ -1,10 +1,32 @@ export default { + event: { + minHeight: '5rem' + }, + horizontal: { + eventContent: { + padding: '1rem 0' + } + }, + vertical: { + eventContent: { + padding: '0 1rem' + } + }, eventMarker: { + size: '1.125rem', + borderRadius: '50%', + borderWidth: '2px', background: '{content.background}', - borderColor: '{content.border.color}', - contentColor: '{primary.color}' + borderColor: '{primary.color}', + content: { + borderRadius: '50%', + size: '0.375rem', + background: 'transparent', + insetShadow: 'none' + } }, eventConnector: { - color: '{content.border.color}' + color: '{content.border.color}', + size: '2px' } }; diff --git a/components/lib/timeline/style/TimelineStyle.js b/components/lib/timeline/style/TimelineStyle.js index 9b32d8184..6e800216d 100644 --- a/components/lib/timeline/style/TimelineStyle.js +++ b/components/lib/timeline/style/TimelineStyle.js @@ -49,17 +49,17 @@ const theme = ({ dt }) => ` .p-timeline-vertical .p-timeline-event-opposite, .p-timeline-vertical .p-timeline-event-content { - padding: 0 1rem; + padding: ${dt('timeline.vertical.event.content.padding')}; } .p-timeline-vertical .p-timeline-event-connector { - width: 2px; + width: ${dt('timeline.event.connector.size')}; } .p-timeline-event { display: flex; position: relative; - min-height: 70px; + min-height: ${dt('timeline.event.min.height')}; } .p-timeline-event:last-child { @@ -68,12 +68,10 @@ const theme = ({ dt }) => ` .p-timeline-event-opposite { flex: 1; - padding: 0 1rem; } .p-timeline-event-content { flex: 1; - padding: 0 1rem; } .p-timeline-event-separator { @@ -89,19 +87,21 @@ const theme = ({ dt }) => ` justify-content: center; position: relative; align-self: baseline; - border: 2px solid ${dt('timeline.event.marker.border.color')}; - border-radius: 50%; - width: 1.125rem; - height: 1.125rem; - background-color: ${dt('timeline.event.marker.background')}; + border-width: ${dt('timeline.event.marker.border.width')}; + border-style: solid; + border-color: ${dt('timeline.event.marker.border.color')}; + border-radius: ${dt('timeline.event.marker.border.radius')}; + width: ${dt('timeline.event.marker.size')}; + height: ${dt('timeline.event.marker.size')}; + background: ${dt('timeline.event.marker.background')}; } .p-timeline-event-marker::before { content: " "; - border-radius: 50%; - width: 0.375rem; - height: 0.375rem; - background: ${dt('timeline.event.marker.content.color')}; + border-radius: ${dt('timeline.event.marker.content.border.radius')}; + width: ${dt('timeline.event.marker.content.size')}; + height:${dt('timeline.event.marker.content.size')}; + background: ${dt('timeline.event.marker.content.background')}; } .p-timeline-event-marker::after { @@ -109,8 +109,8 @@ const theme = ({ dt }) => ` position: absolute; width: 100%; height: 100%; - border-radius: 50%; - box-shadow: 0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12); + border-radius: ${dt('timeline.event.marker.border.radius')}; + box-shadow: ${dt('timeline.event.marker.content.inset.shadow')}; } .p-timeline-event-connector { @@ -137,12 +137,12 @@ const theme = ({ dt }) => ` .p-timeline-horizontal .p-timeline-event-connector { width: 100%; - height: 2px; + height: ${dt('timeline.event.connector.size')}; } .p-timeline-horizontal .p-timeline-event-opposite, .p-timeline-horizontal .p-timeline-event-content { - padding: 1rem 0; + padding: ${dt('timeline.horizontal.event.content.padding')}; } .p-timeline-horizontal.p-timeline-alternate .p-timeline-event:nth-child(even) {