refactor(sample) refactor the sample component - #108
Conversation
- fix fiter input icon position in none chromium browsers - fix filtering input jumping in firefox
|
@desig9stein , so far I am seeing the following issues: Most grid samples don't show their bottom borders
The fit content implementation seems to work only in FF on Windows and latest ChromeThis is how the first calendar sample looks in FF 152.0.5
But in Edge 150.0.4078.65 it still doesn't work. It seems that the approach might be a bit hit and miss:
But after updating Chrome, the calendar now looks okay there (compared to when I showed it to you) |
|
@ChronosSF The shadow cutoff occurs because the new Sample component defaults to 16px of padding around the iframe, and in samples with a hardcoded height, we will see this problem. I can fix this in a few ways: I lean toward Option 1 to keep things clean, but let me know what you think! |
All 14 conflicts were caused by master's repo-wide Prettier reformat (771d566) colliding with this branch's content. Resolved by normalizing each conflict's base/ours/theirs stages with master's Prettier config and re-running the 3-way merge, so the resolutions contain only semantic changes from both sides. Preserved from master, verified in src/scripts/sample-widget.ts (the one file where both sides touched adjacent lines): - the unused `codeSandboxSvg` import stays removed - `onCodeSandbox` -> `_onCodeSandbox` rename kept - `widgetIndex` stays out of AngularCodeService.init's destructuring - the requestIdleCallback ternary -> if/else rewrite kept Also brought this branch in line with the tooling master added: - formatted the four files added here (mock-demo-{avatar,responsive,tall} .astro, _copy-button.scss), which predate Prettier - built the quick-start snippet in playground sample.astro from a `FENCE` const, since a bare `---` inside a template literal makes oxlint's Astro parser read it as the end of frontmatter and fail with "Unterminated string" Verified: oxlint clean, prettier --check clean, astro check 0 errors, playground build succeeds (29 pages, incl. master's new anatomy/faq). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…s are required upfront
There was a problem hiding this comment.
Pull request overview
This PR refactors the MDX Sample component to support new layout/design requirements (Issue #105), including fit-to-content sizing, configurable spacing/alignment, and resizable previews, plus related UI/style adjustments across the docs shell.
Changes:
- Adds
fitContent,spacing,position,resizable,noBorder, andnoBackgroundcapabilities toSample, with corresponding iframe wiring (measurement/postMessage) and styling. - Refactors code-copy button theming into a shared SCSS mixin and aligns copy button variants/styles across code panes.
- Updates docs/playground examples and several layout/search/sidebar styles to address cross-browser spacing/positioning issues.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/styles/global/_variables.scss | Adjusts page layout grid sizing to a responsive minmax range. |
| src/styles/global/_search-shared.scss | Moves header/footer height styling to better match mobile visibility rules. |
| src/styles/global/_copy-button.scss | Introduces a reusable mixin for consistent copy-button palette states. |
| src/styles/global/_code-blocks.scss | Replaces inline copy-button palette rules with the shared mixin. |
| src/scripts/sample-widget.ts | Adds fit-content sizing + resizable sample wiring (ResizeObserver + postMessage contract). |
| src/layouts/DocsLayout/DocsLayout.scss | Tweaks responsive layout behavior (desktop-wide section touched). |
| src/components/mdx/Sample/Sample.scss | Major styling refactor for sample container/layout modes (fit-content, spacing, resizable, etc.). |
| src/components/mdx/Sample/Sample.astro | Expands Sample API and markup to support new sizing/layout options. |
| src/components/mdx/Sample/README.md | Updates Sample API documentation to reflect new props/semantics. |
| src/components/DocsTree/docs-tree.scss | Adjusts tree item label layout. |
| src/components/DocsSubHeader/DocsSubHeader.scss | Updates subheader spacing. |
| src/components/DocsSidebar/SidebarFilterInput.scss | Adjusts filter icon spacing for non-Chromium browsers. |
| src/components/DocsSidebar/DocsSidebar.scss | Updates sidebar scrolling/layout behavior. |
| playground/src/pages/mock-demo.astro | Simplifies the base mock demo page content. |
| playground/src/pages/mock-demo-tall.astro | Adds a tall mock page to demonstrate fitContent height growth. |
| playground/src/pages/mock-demo-responsive.astro | Adds a responsive mock page to demonstrate resizable. |
| playground/src/pages/mock-demo-avatar.astro | Adds a small-content mock page to demonstrate fitContent + positioning. |
| playground/src/pages/components/sample.astro | Reworks Sample playground docs into a structured API + live examples page. |
| playground/src/components/MockSample.astro | Aligns MockSample behavior/markup with the updated Sample component. |
Suppressed comments (1)
src/scripts/sample-widget.ts:655
data.widthis only type-checked; NaN/Infinity/negative widths would still be applied whenuseWidthis true. Add a finite/positive check before passing it into setFitSize().
setFitSize(iframe, {
height: data.height,
width: useWidth && typeof data.width === 'number' ? data.width : undefined,
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>



Closes: #105
To test you need this branch IgniteUI/igniteui-angular-samples#3996