-
Notifications
You must be signed in to change notification settings - Fork 38
feat(v1): TypeStripe + DetailCard slot (Phase 1 - Foundation PR 5) #483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vitorvasc
merged 5 commits into
open-telemetry:main
from
vitorvasc:feat/84-pr5-typestripe
May 18, 2026
+138
−0
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
accb69c
feat(ui): add TypeStripe + DetailCard typeStripe slot
vitorvasc 8388472
refactor(ui): tighten TypeStripe API after review
vitorvasc 4ff5b9d
refactor(ui): address Copilot review
vitorvasc cade6b5
Merge branch 'main' into feat/84-pr5-typestripe
vitorvasc dde29ca
Merge branch 'main' into feat/84-pr5-typestripe
lucacavenaghi97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
ecosystem-explorer/src/components/ui/type-stripe-colors.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /* | ||
| * TypeStripe color map — shared between the standalone `<TypeStripe>` | ||
| * primitive and the `typeStripe` slot on `<DetailCard>`. Lives in its own | ||
| * file so React Fast Refresh stays happy (`react-refresh/only-export-components` | ||
| * disallows constants alongside component exports). | ||
| */ | ||
|
|
||
| import type { CollectorComponent } from "@/types/collector"; | ||
|
|
||
| export type CollectorComponentType = CollectorComponent["type"]; | ||
|
|
||
| export const TYPE_STRIPE_COLORS: Record<CollectorComponentType, string> = { | ||
| receiver: "hsl(200 85% 45%)", | ||
| processor: "hsl(270 70% 55%)", | ||
| exporter: "hsl(38 95% 52%)", | ||
| connector: "hsl(330 75% 50%)", | ||
| extension: "hsl(165 70% 40%)", | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| import { render } from "@testing-library/react"; | ||
| import { describe, it, expect } from "vitest"; | ||
| import { type CollectorComponentType, TYPE_STRIPE_COLORS } from "./type-stripe-colors"; | ||
| import { TypeStripe } from "./type-stripe"; | ||
|
|
||
| const types: CollectorComponentType[] = [ | ||
| "receiver", | ||
| "processor", | ||
| "exporter", | ||
| "connector", | ||
| "extension", | ||
| ]; | ||
|
|
||
| describe("TypeStripe", () => { | ||
| it.each(types)("renders an aria-hidden element with type=%s and the matching color", (type) => { | ||
| const { container } = render(<TypeStripe type={type} />); | ||
| const el = container.querySelector(".type-stripe"); | ||
| expect(el).not.toBeNull(); | ||
| expect(el).toHaveAttribute("data-type", type); | ||
| expect(el).toHaveAttribute("aria-hidden"); | ||
| expect(el).toHaveStyle({ backgroundColor: TYPE_STRIPE_COLORS[type] }); | ||
| }); | ||
|
|
||
| it("exports a stable color for each of the five canonical types", () => { | ||
| expect(Object.keys(TYPE_STRIPE_COLORS).sort()).toEqual(types.slice().sort()); | ||
| for (const c of Object.values(TYPE_STRIPE_COLORS)) { | ||
| expect(c).toMatch(/^hsl\(/); | ||
| } | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /* | ||
| * TypeStripe — 4px left-edge color stripe used to flag the OTel-collector | ||
| * component type at the leading edge of cards, list rows, and detail headers. | ||
| * | ||
| * Five canonical types: receiver / processor / exporter / connector / | ||
| * extension. Color mapping lives in `./type-stripe-colors.ts` (split out so | ||
| * React Fast Refresh stays happy). | ||
| * | ||
| * Two consumers: | ||
| * 1. As a slot inside `<DetailCard typeStripe="...">` — DetailCard mounts | ||
| * `<TypeStripe>` with its own positioning className, so the stripe | ||
| * rendering stays in one place. | ||
| * 2. As a standalone `<TypeStripe type="..." />` for list rows that don't | ||
| * use DetailCard (e.g. compact list view in Phase 4). | ||
| */ | ||
|
|
||
| import { type CollectorComponentType, TYPE_STRIPE_COLORS } from "./type-stripe-colors"; | ||
|
|
||
| export interface TypeStripeProps { | ||
| type: CollectorComponentType; | ||
| className?: string; | ||
| } | ||
|
|
||
| export function TypeStripe({ type, className }: TypeStripeProps) { | ||
| return ( | ||
| <span | ||
| aria-hidden | ||
| className={className ? `type-stripe ${className}` : "type-stripe"} | ||
| data-type={type} | ||
| style={{ backgroundColor: TYPE_STRIPE_COLORS[type] }} | ||
| /> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.