Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/components/patterns/ReadMore/ReadMore.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
/**
* ReadMore Pattern Component
*
* Callout block with a book icon that points readers to a related guide
* or page for further reading. Visually mirrors the Alert primitive, but
* renders as an `aside` so it stays out of the heading outline; screen
* readers announce it as complementary content labeled by the title.
*
* Write the slot content as a full sentence with the link text naming the
* target page, so both prose and link-list navigation read well.
*
* @example
* <ReadMore>
* For more information, see the [Error handling](/guide/error-handling) guide.
* </ReadMore>
*/

import './ReadMore.css';
import type { HTMLAttributes } from 'astro/types';
import { Icon } from 'astro-icon/components';
import { Body, Flex } from '@components/primitives';

type Props = { title?: string } & HTMLAttributes<'aside'>;

const { title = 'Read more', class: className, ...rest } = Astro.props;
---

<aside class:list={['read-more', className]} aria-label={title} {...rest}>
<Flex align="center" gap="2">
<Icon name="fluent:book-open-16-regular" class="read-more__icon" size="18" aria-hidden="true" />
<Body as="p" vMargin={false} weight="bold" aria-hidden="true">{title}</Body>
</Flex>
<div class="read-more__description">
<slot />
</div>
</aside>
29 changes: 29 additions & 0 deletions src/components/patterns/ReadMore/ReadMore.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* ReadMore Component Styles
*/

@layer patterns {
.read-more {
display: flex;
flex-direction: column;
gap: var(--space-1);
padding: var(--space-4);
border-left-width: var(--border-width-4);
border-left-style: solid;
border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
margin: var(--space-4) 0;
background-color: var(--color-bg-success);
border-color: var(--color-border-success);
}

.read-more__icon {
flex-shrink: 0;
color: var(--color-text-success);
}

.read-more__description {
p {
margin: 0;
}
}
}
1 change: 1 addition & 0 deletions src/components/patterns/ReadMore/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as ReadMore } from './ReadMore.astro';
1 change: 1 addition & 0 deletions src/components/patterns/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ export { default as WriteBanner } from './WriteBanner/WriteBanner.astro';
export { default as RelatedContent } from './RelatedContent/RelatedContent.astro';
export { default as DocBottomNav } from './DocBottomNav/DocBottomNav.astro';
export { default as MiddlewareInfo } from './MiddlewareInfo/MiddlewareInfo.astro';
export { default as ReadMore } from './ReadMore/ReadMore.astro';
Loading
Loading