Skip to content

Commit 2842a3a

Browse files
feat(components): Add ContentSeparator component (#15002)
## Summary This PR introduces the ContentSeparator component - a labeled horizontal divider for visually separating content sections. ## Features - Labeled horizontal divider with message centered between lines - Multiple visual variants: neutral, info, warning, success, danger - Configurable vertical spacing (marginTopRem, marginBottomRem) - Rectangular style aligned with code block visuals - Text constrained to 2/3 width with lines filling remaining space ## Usage ```jsx <ContentSeparator message="Advanced configuration" /> <ContentSeparator message="Warning" variant="warning" /> <ContentSeparator message="Next Steps" variant="success" marginTopRem={3} /> ``` ## Files Added - `src/components/contentSeparator/index.tsx` - Component implementation - `src/components/contentSeparator/style.module.scss` - Styles - Updated `src/mdxComponents.ts` to register component for MDX usage ## Status - [ ] Component implementation complete - [ ] Styles finalized - [ ] MDX integration tested - [ ] Documentation added - [ ] Review requested --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent 2be5af4 commit 2842a3a

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* Component: ContentSeparator
3+
*
4+
* A labeled horizontal divider with the message centered between two lines.
5+
* Useful for visually separating groups of content within a page.
6+
*
7+
* Props overview
8+
* - message: string — text shown in the label (required)
9+
* - variant: 'neutral' | 'info' | 'warning' | 'success' | 'danger' (default 'info')
10+
* - marginTopRem, marginBottomRem: control vertical spacing (defaults 2 / 1)
11+
*
12+
* Usage
13+
* <ContentSeparator message="Advanced configuration" />
14+
*/
15+
type Props = {
16+
/** The message displayed in the center label. */
17+
message: string;
18+
/** Extra spacing below (in rem). Default: 1. */
19+
marginBottomRem?: number;
20+
/** Extra spacing above (in rem). Default: 2. */
21+
marginTopRem?: number;
22+
/** Optional visual style; default 'info'. */
23+
variant?: 'neutral' | 'info' | 'warning' | 'success' | 'danger';
24+
};
25+
26+
import styles from './style.module.scss';
27+
28+
/**
29+
* ContentSeparator
30+
*
31+
* A labeled horizontal separator that sits between content blocks.
32+
* Example:
33+
* <ContentSeparator message="Advanced configuration" />
34+
*/
35+
export function ContentSeparator({
36+
message,
37+
variant = 'info',
38+
marginTopRem = 2,
39+
marginBottomRem = 1,
40+
}: Props) {
41+
return (
42+
<section
43+
className={styles.wrapper}
44+
style={{marginTop: `${marginTopRem}rem`, marginBottom: `${marginBottomRem}rem`}}
45+
>
46+
<div className={styles.separator} role="separator" aria-label={message}>
47+
<span className={styles.line} aria-hidden="true" />
48+
<span className={`${styles.label} ${styles[`label--${variant}`]}`}>
49+
{message}
50+
</span>
51+
<span className={styles.line} aria-hidden="true" />
52+
</div>
53+
</section>
54+
);
55+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.wrapper {}
2+
3+
.separator {
4+
display: flex;
5+
align-items: center;
6+
gap: 0.75rem;
7+
width: 100%;
8+
}
9+
10+
.line {
11+
flex: 1 1 auto;
12+
height: 1px;
13+
background: var(--gray-a5);
14+
}
15+
16+
.label {
17+
display: inline-flex;
18+
align-items: center;
19+
padding: 0.35rem 0.75rem;
20+
border-radius: 6px;
21+
font-weight: 500;
22+
font-size: 0.95rem;
23+
color: #fff;
24+
background: var(--code-background);
25+
border: 1px solid var(--accent-11);
26+
box-shadow: 0 1px 2px var(--gray-a3);
27+
max-width: 66.6667%;
28+
flex: 0 1 66.6667%;
29+
text-align: center;
30+
justify-content: center;
31+
white-space: normal;
32+
}
33+
34+
.label--neutral {}
35+
.label--info { background: var(--accent-a3, var(--gray-a3)); border-color: var(--accent-a6, var(--gray-a6)); }
36+
.label--success { background: var(--green-a3, var(--gray-a3)); border-color: var(--green-a6, var(--gray-a6)); }
37+
.label--warning { background: var(--yellow-a3, var(--gray-a3)); border-color: var(--yellow-a6, var(--gray-a6)); }
38+
.label--danger { background: var(--red-a3, var(--gray-a3)); border-color: var(--red-a6, var(--gray-a6)); }
39+
40+
.content { margin-top: 1rem; }
41+

src/mdxComponents.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {CodeTabs} from './components/codeTabs';
88
import {CommunitySupportedPlatforms} from './components/communitySupportedPlatforms';
99
import {ConfigKey} from './components/configKey';
1010
import {ConfigValue} from './components/configValue';
11+
import {ContentSeparator} from './components/contentSeparator';
1112
import {CreateGitHubAppForm} from './components/createGitHubAppForm';
1213
import {DefinitionList} from './components/definitionList';
1314
import {DevDocsCardGrid} from './components/devDocsCardGrid';
@@ -59,6 +60,7 @@ export function mdxComponents(
5960
Card,
6061
CliChecksumTable,
6162
CommunitySupportedPlatforms,
63+
ContentSeparator,
6264
DevDocsCardGrid,
6365
PlatformFilter,
6466
CodeBlock,

0 commit comments

Comments
 (0)