Skip to content

Commit 0124028

Browse files
committed
Merge branch 'feat/react-docs-restructure-clean' of https://github.com/getsentry/sentry-docs into feat/react-docs-restructure-clean
* 'feat/react-docs-restructure-clean' of https://github.com/getsentry/sentry-docs: Fixing step connector typings Reformatting into the getting-started flow instead of quickstart flow. docs(react/getting-started): collapse React 16–18 section inside Expandable docs(react/getting-started): scope StepConnector around Steps 1–7 only docs(react/getting-started): replace onboarding UI with StepConnector and add content Break before Customizing Replays react(getting-started): fix MDX – close OnboardingOption tags and complete Step 6 code react: restore React guide index to origin/master version react: add Getting Started page (split from current index content) React: Restructure documentation with step-based flow
2 parents 5548e90 + 94b6063 commit 0124028

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/components/stepConnector/index.tsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use client';
1+
"use client";
22

33
/**
44
* Component: StepConnector / StepComponent
@@ -27,11 +27,11 @@
2727
* - --rail-x, --circle, --gap control rail position and circle size/spacing.
2828
*/
2929

30-
import {useEffect, useMemo, useRef, useState} from 'react';
30+
import {useEffect, useMemo, useRef, useState} from "react";
3131

32-
import styles from './style.module.scss';
32+
import styles from "./style.module.scss";
3333

34-
type Persistence = 'session' | 'none';
34+
type Persistence = "session" | "none";
3535

3636
type Props = {
3737
children: React.ReactNode;
@@ -47,24 +47,24 @@ type Props = {
4747
showReset?: boolean;
4848
/** Start numbering from this value. @defaultValue 1 */
4949
startAt?: number;
50-
}
50+
};
5151

5252
export function StepComponent({
5353
children,
5454
startAt = 1,
55-
selector = 'h2',
55+
selector = "h2",
5656
showNumbers = true,
5757
checkable = false,
58-
persistence = 'session',
58+
persistence = "session",
5959
showReset = true,
6060
}: Props) {
6161
const containerRef = useRef<HTMLDivElement | null>(null);
6262
const [completed, setCompleted] = useState<Set<string>>(new Set());
6363

6464
const storageKey = useMemo(() => {
65-
if (typeof window === 'undefined' || persistence !== 'session') return null;
65+
if (typeof window === "undefined" || persistence !== "session") return null;
6666
try {
67-
const path = window.location?.pathname ?? '';
67+
const path = window.location?.pathname ?? "";
6868
return `stepConnector:${path}:${selector}:${startAt}`;
6969
} catch {
7070
return null;
@@ -84,24 +84,24 @@ export function StepComponent({
8484

8585
headings.forEach(h => {
8686
h.classList.remove(styles.stepHeading);
87-
h.removeAttribute('data-step');
88-
h.removeAttribute('data-completed');
87+
h.removeAttribute("data-step");
88+
h.removeAttribute("data-completed");
8989
const existingToggle = h.querySelector(`.${styles.stepToggle}`);
9090
if (existingToggle) existingToggle.remove();
9191
});
9292

9393
headings.forEach((h, idx) => {
9494
const stepNumber = startAt + idx;
95-
h.setAttribute('data-step', String(stepNumber));
95+
h.setAttribute("data-step", String(stepNumber));
9696
h.classList.add(styles.stepHeading);
9797

9898
if (checkable) {
99-
const btn = document.createElement('button');
100-
btn.type = 'button';
99+
const btn = document.createElement("button");
100+
btn.type = "button";
101101
btn.className = styles.stepToggle;
102-
btn.setAttribute('aria-label', `Toggle completion for step ${stepNumber}`);
103-
btn.setAttribute('aria-pressed', completed.has(h.id) ? 'true' : 'false');
104-
btn.addEventListener('click', () => {
102+
btn.setAttribute("aria-label", `Toggle completion for step ${stepNumber}`);
103+
btn.setAttribute("aria-pressed", completed.has(h.id) ? "true" : "false");
104+
btn.addEventListener("click", () => {
105105
setCompleted(prev => {
106106
const next = new Set(prev);
107107
if (next.has(h.id)) next.delete(h.id);
@@ -117,8 +117,8 @@ export function StepComponent({
117117
return () => {
118118
headings.forEach(h => {
119119
h.classList.remove(styles.stepHeading);
120-
h.removeAttribute('data-step');
121-
h.removeAttribute('data-completed');
120+
h.removeAttribute("data-step");
121+
h.removeAttribute("data-completed");
122122
const existingToggle = h.querySelector(`.${styles.stepToggle}`);
123123
if (existingToggle) existingToggle.remove();
124124
});
@@ -145,10 +145,10 @@ export function StepComponent({
145145
);
146146
headings.forEach(h => {
147147
const isDone = completed.has(h.id);
148-
if (isDone) h.setAttribute('data-completed', 'true');
149-
else h.removeAttribute('data-completed');
148+
if (isDone) h.setAttribute("data-completed", "true");
149+
else h.removeAttribute("data-completed");
150150
const btn = h.querySelector(`.${styles.stepToggle}`) as HTMLButtonElement | null;
151-
if (btn) btn.setAttribute('aria-pressed', isDone ? 'true' : 'false');
151+
if (btn) btn.setAttribute("aria-pressed", isDone ? "true" : "false");
152152
});
153153

154154
if (storageKey && checkable) {
@@ -175,7 +175,7 @@ export function StepComponent({
175175
<div
176176
ref={containerRef}
177177
className={styles.stepContainer}
178-
data-shownumbers={showNumbers ? 'true' : 'false'}
178+
data-shownumbers={showNumbers ? "true" : "false"}
179179
>
180180
{checkable && showReset && (
181181
<div className={styles.resetRow}>

0 commit comments

Comments
 (0)