@@ -26,7 +26,7 @@ import {
2626 UserActor ,
2727 VariantSection ,
2828} from './internal/timelineStoryHelpers'
29- import { CODE_SCANNING_TAXONOMY , actorTypeForLogin , toEventDataAttributes , type CodeScanningEventType } from './taxonomy'
29+ import { eventDataAttributesFor } from './taxonomy'
3030import classes from './Timeline.code-scanning.features.stories.module.css'
3131
3232/**
@@ -175,23 +175,14 @@ const SubRow = ({children}: {children: React.ReactNode}) => <div className={clas
175175
176176/**
177177 * Per-row taxonomy `data-*` attributes (Phase 3 tagging, github/primer#6664,
178- * epic #6654). Projects a Code Scanning leaf event type through the shared
179- * `toEventDataAttributes` serializer from the taxonomy module (primer/react#8180),
180- * mirroring the License Compliance pilot (primer/react#8216). `category` and
181- * `visibility` are derived FROM `CODE_SCANNING_TAXONOMY` so the story never
182- * hand-maintains them. Pass the row's rendered `UserActor` login for USER events
183- * (resolves `data-actor-type` via `actorTypeForLogin`); omit it for SYSTEM rows
184- * so `data-actor-type` is left off entirely. Spread the result onto each
185- * `Timeline.Item`.
178+ * epic #6654). Each `Timeline.Item` below projects its Code Scanning leaf event
179+ * type through the shared `eventDataAttributesFor('code-scanning', <leaf>,
180+ * login?)` helper (`./taxonomy`, primer/react#8180), mirroring the License
181+ * Compliance pilot (primer/react#8216). `category` and `visibility` are derived
182+ * FROM the catalog so the story never hand-maintains them. Pass the row's
183+ * rendered `UserActor` login for USER events (resolves `data-actor-type`); omit
184+ * it for SYSTEM rows so `data-actor-type` is left off entirely.
186185 */
187- const codeScanningAttrs = ( type : CodeScanningEventType , login ?: string ) =>
188- toEventDataAttributes ( {
189- scope : 'code-scanning' ,
190- type,
191- category : CODE_SCANNING_TAXONOMY [ type ] . category ,
192- visibility : CODE_SCANNING_TAXONOMY [ type ] . visibility ,
193- actorType : login ? actorTypeForLogin ( login ) : undefined ,
194- } )
195186
196187export default {
197188 title : 'Components/Timeline/Events/Code Scanning' ,
@@ -240,7 +231,7 @@ export const EventDetected = () => (
240231 sub-row, and a right-aligned tool-version Label (Timeline.Actions). */ }
241232 < VariantSection label = "First detected in commit" >
242233 < Timeline aria-label = "Code scanning alert timeline" >
243- < Timeline . Item { ...codeScanningAttrs ( 'detected' ) } >
234+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'detected' ) } >
244235 < Timeline . Badge >
245236 < Octicon icon = { ShieldIcon } />
246237 </ Timeline . Badge >
@@ -274,7 +265,7 @@ export const EventDetected = () => (
274265 card — `show_timeline_commit?` is false for this event). */ }
275266 < VariantSection label = "Appeared in branch" >
276267 < Timeline aria-label = "Code scanning alert timeline" >
277- < Timeline . Item { ...codeScanningAttrs ( 'appeared' ) } >
268+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'appeared' ) } >
278269 < Timeline . Badge >
279270 < Octicon icon = { GitBranchIcon } />
280271 </ Timeline . Badge >
@@ -304,7 +295,7 @@ export const EventDetected = () => (
304295 {category}" pill (rendered when the alert has more than one category). */ }
305296 < VariantSection label = "Reappeared in branch" >
306297 < Timeline aria-label = "Code scanning alert timeline" >
307- < Timeline . Item { ...codeScanningAttrs ( 'reappeared' ) } >
298+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'reappeared' ) } >
308299 < Timeline . Badge >
309300 < Octicon icon = { ShieldIcon } />
310301 </ Timeline . Badge >
@@ -348,7 +339,7 @@ export const EventFixed = () => (
348339 { /* Fixed — selected ref → SOLID purple shield-check */ }
349340 < VariantSection label = "Fixed in branch (current ref)" >
350341 < Timeline aria-label = "Code scanning alert timeline" >
351- < Timeline . Item { ...codeScanningAttrs ( 'fixed' ) } >
342+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'fixed' ) } >
352343 < Timeline . Badge variant = "done" >
353344 < Octicon icon = { ShieldCheckIcon } />
354345 </ Timeline . Badge >
@@ -363,7 +354,7 @@ export const EventFixed = () => (
363354 { /* Fixed — non-selected ref → bare default check */ }
364355 < VariantSection label = "Fixed in branch (other ref)" >
365356 < Timeline aria-label = "Code scanning alert timeline" >
366- < Timeline . Item { ...codeScanningAttrs ( 'fixed' ) } >
357+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'fixed' ) } >
367358 < Timeline . Badge >
368359 < Octicon icon = { CheckIcon } />
369360 </ Timeline . Badge >
@@ -381,7 +372,7 @@ export const EventFixed = () => (
381372 carries data-event-type="closed" despite its visual "Fixed" grouping. */ }
382373 < VariantSection label = "Configuration deleted (current ref)" >
383374 < Timeline aria-label = "Code scanning alert timeline" >
384- < Timeline . Item { ...codeScanningAttrs ( 'closed' ) } >
375+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'closed' ) } >
385376 < Timeline . Badge variant = "done" >
386377 < Octicon icon = { ShieldCheckIcon } />
387378 </ Timeline . Badge >
@@ -397,7 +388,7 @@ export const EventFixed = () => (
397388 { /* Config deleted — non-selected ref → bare default check */ }
398389 < VariantSection label = "Configuration deleted (other ref)" >
399390 < Timeline aria-label = "Code scanning alert timeline" >
400- < Timeline . Item { ...codeScanningAttrs ( 'closed' ) } >
391+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'closed' ) } >
401392 < Timeline . Badge >
402393 < Octicon icon = { CheckIcon } />
403394 </ Timeline . Badge >
@@ -429,7 +420,7 @@ export const EventClosedByUser = () => (
429420 { /* Closed as false positive — with a resolution-note sub-row */ }
430421 < VariantSection label = "Closed as false positive" >
431422 < Timeline aria-label = "Code scanning alert timeline" >
432- < Timeline . Item { ...codeScanningAttrs ( 'closed' , 'monalisa' ) } >
423+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'closed' , 'monalisa' ) } >
433424 < Timeline . Badge variant = "danger" >
434425 < Octicon icon = { ShieldXIcon } />
435426 </ Timeline . Badge >
@@ -446,7 +437,7 @@ export const EventClosedByUser = () => (
446437 { /* Closed as used in tests */ }
447438 < VariantSection label = "Closed as used in tests" >
448439 < Timeline aria-label = "Code scanning alert timeline" >
449- < Timeline . Item { ...codeScanningAttrs ( 'closed' , 'monalisa' ) } >
440+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'closed' , 'monalisa' ) } >
450441 < Timeline . Badge variant = "danger" >
451442 < Octicon icon = { ShieldXIcon } />
452443 </ Timeline . Badge >
@@ -462,7 +453,7 @@ export const EventClosedByUser = () => (
462453 { /* Closed as won't fix */ }
463454 < VariantSection label = "Closed as won't fix" >
464455 < Timeline aria-label = "Code scanning alert timeline" >
465- < Timeline . Item { ...codeScanningAttrs ( 'closed' , 'monalisa' ) } >
456+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'closed' , 'monalisa' ) } >
466457 < Timeline . Badge variant = "danger" >
467458 < Octicon icon = { ShieldXIcon } />
468459 </ Timeline . Badge >
@@ -479,7 +470,7 @@ export const EventClosedByUser = () => (
479470 `resolution == :NO_RESOLUTION`. */ }
480471 < VariantSection label = "Closed (no resolution)" >
481472 < Timeline aria-label = "Code scanning alert timeline" >
482- < Timeline . Item { ...codeScanningAttrs ( 'closed' , 'monalisa' ) } >
473+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'closed' , 'monalisa' ) } >
483474 < Timeline . Badge variant = "danger" >
484475 < Octicon icon = { ShieldXIcon } />
485476 </ Timeline . Badge >
@@ -506,7 +497,7 @@ export const EventReopened = () => (
506497 < Examples >
507498 < VariantSection label = "Reopened" >
508499 < Timeline aria-label = "Code scanning alert timeline" >
509- < Timeline . Item { ...codeScanningAttrs ( 'reopened' , 'monalisa' ) } >
500+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'reopened' , 'monalisa' ) } >
510501 < Timeline . Badge variant = "success" >
511502 < Octicon icon = { DotFillIcon } />
512503 </ Timeline . Badge >
@@ -541,7 +532,7 @@ export const EventDismissalRequested = () => (
541532 < Examples >
542533 < VariantSection label = "Requested to dismiss" >
543534 < Timeline aria-label = "Code scanning alert timeline" >
544- < Timeline . Item { ...codeScanningAttrs ( 'dismissal_requested' , 'monalisa' ) } >
535+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'dismissal_requested' , 'monalisa' ) } >
545536 < Timeline . Badge >
546537 < Octicon icon = { CommentIcon } />
547538 </ Timeline . Badge >
@@ -581,7 +572,7 @@ export const EventDismissalReviewed = () => (
581572 { /* Approved — check icon + reviewer-comment sub-row */ }
582573 < VariantSection label = "Approved dismissal" >
583574 < Timeline aria-label = "Code scanning alert timeline" >
584- < Timeline . Item { ...codeScanningAttrs ( 'dismissal_reviewed' , 'monalisa' ) } >
575+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'dismissal_reviewed' , 'monalisa' ) } >
585576 < Timeline . Badge >
586577 < Octicon icon = { CheckIcon } />
587578 </ Timeline . Badge >
@@ -598,7 +589,7 @@ export const EventDismissalReviewed = () => (
598589 { /* Denied — x icon */ }
599590 < VariantSection label = "Denied dismissal" >
600591 < Timeline aria-label = "Code scanning alert timeline" >
601- < Timeline . Item { ...codeScanningAttrs ( 'dismissal_reviewed' , 'monalisa' ) } >
592+ < Timeline . Item { ...eventDataAttributesFor ( 'code-scanning' , 'dismissal_reviewed' , 'monalisa' ) } >
602593 < Timeline . Badge >
603594 < Octicon icon = { XIcon } />
604595 </ Timeline . Badge >
0 commit comments