-
Notifications
You must be signed in to change notification settings - Fork 0
Component - blockquote #11
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
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
62cf975
page: unpublish "test page" (en)
Infi-Knight a5483ff
page: add "test page" (en)
Infi-Knight 8caad53
page: unpublish "test page" (en)
Infi-Knight a3f02c0
page: add "test page" (en)
Infi-Knight 8083c2c
page: unpublish "test page" (en)
Infi-Knight 55967a4
page: add "test page" (en)
Infi-Knight 0dccd37
page: unpublish "test page" (en)
Infi-Knight f186c18
page: add "test page" (en)
Infi-Knight 384169e
page: unpublish "test page" (en)
Infi-Knight 9ba6677
page: add "test page" (en)
Infi-Knight ff793b8
page: unpublish "test page" (en)
Infi-Knight 90dfc40
page: add "test page" (en)
Infi-Knight c3ba778
page: unpublish "test page" (en)
Infi-Knight 3c29210
page: add "test page" (en)
Infi-Knight 792388d
page: unpublish "test page" (en)
Infi-Knight d062943
page: add "test page" (en)
Infi-Knight 4f67873
page: unpublish "test page" (en)
Infi-Knight c704cbd
page: add "test page" (en)
Infi-Knight 19be915
page: unpublish "test page" (en)
Infi-Knight 07f6cb2
page: add "test page" (en)
Infi-Knight fe9e1d2
page: unpublish "test page" (en)
Infi-Knight b636e2b
page: add "test page" (en)
Infi-Knight 8dfb330
page: unpublish "test page" (en)
Infi-Knight 542748d
page: add "test page" (en)
Infi-Knight 9e16a79
page: unpublish "test page" (en)
Infi-Knight 4ab8a86
page: add "test page" (en)
Infi-Knight 91830ad
wip: blockquote
Infi-Knight 0f7798d
update readme
Infi-Knight 1dd5d46
page: unpublish "test page" (en)
Infi-Knight f221c60
page: add "test page" (en)
Infi-Knight 1c5244a
page: unpublish "test page" (en)
Infi-Knight 50547db
page: add "test page" (en)
Infi-Knight b40755c
page: unpublish "test page" (en)
Infi-Knight 0c43d07
page: add "test page" (en)
Infi-Knight 14f3751
page: unpublish "test page" (en)
Infi-Knight 04bf7ca
page: add "test page" (en)
Infi-Knight 55e89f9
page: unpublish "test page" (en)
Infi-Knight f08b729
page: add "test page" (en)
Infi-Knight 29de6a3
use non-rich text for quote src, styling fixes
Infi-Knight 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
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
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
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,18 @@ | ||
| { | ||
| "collectionName": "components_blocks_blockquotes", | ||
| "info": { | ||
| "displayName": "Blockquote", | ||
| "icon": "quote", | ||
| "description": "A styled blockquote with optional attribution" | ||
| }, | ||
| "options": {}, | ||
| "attributes": { | ||
| "quote": { | ||
| "type": "text", | ||
| "required": true | ||
| }, | ||
| "source": { | ||
| "type": "richtext" | ||
| } | ||
| } | ||
| } |
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
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
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
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,78 @@ | ||
| --- | ||
| import MarkdownIt from 'markdown-it' | ||
|
|
||
| interface Props { | ||
| quote: string | ||
| source?: string | ||
| } | ||
|
|
||
| const { quote, source } = Astro.props | ||
|
|
||
| const md = new MarkdownIt({ html: true, linkify: true, typographer: true }) | ||
| const htmlSource = source ? md.renderInline(source) : '' | ||
|
|
||
| // Strip any existing quotes and add curly quotes for consistent output | ||
| // Handles straight quotes ("), curly quotes (" " ' '), and single quotes (' ') | ||
| let trimmedQuote = quote.trim() | ||
|
|
||
| // Strip any leading quote (any type) | ||
| if ( | ||
| trimmedQuote.startsWith('"') || | ||
| trimmedQuote.startsWith('"') || | ||
| trimmedQuote.startsWith("'") || | ||
| trimmedQuote.startsWith("'") | ||
| ) { | ||
| trimmedQuote = trimmedQuote.slice(1) | ||
| } | ||
|
|
||
| // Strip any trailing quote (any type) | ||
| if ( | ||
| trimmedQuote.endsWith('"') || | ||
| trimmedQuote.endsWith('"') || | ||
| trimmedQuote.endsWith("'") || | ||
| trimmedQuote.endsWith("'") | ||
| ) { | ||
| trimmedQuote = trimmedQuote.slice(0, -1) | ||
| } | ||
|
|
||
| // Always use curly quotes for consistent styling | ||
| const formattedQuote = `“${trimmedQuote.trim()}”` | ||
| --- | ||
|
|
||
| <div class="ps-space-s py-space-2xs border-l-4 border-primary mb-space-s"> | ||
| <blockquote class="text-step-1"> | ||
| <p>{formattedQuote}</p> | ||
| </blockquote> | ||
| { | ||
| htmlSource && ( | ||
| <p> | ||
| — <cite class="text-step-1" set:html={htmlSource} /> | ||
| </p> | ||
| ) | ||
| } | ||
| </div> | ||
|
|
||
| <!-- | ||
| Styling rendered HTML from set:html | ||
|
|
||
| Since set:html injects raw HTML that doesn't receive Astro's scoped data | ||
| attributes, we use :global() to target injected child elements while keeping | ||
| the parent selector scoped to this component. | ||
| --> | ||
| <style> | ||
| /* Reset inherited prose styles for rendered HTML inside cite */ | ||
| cite { | ||
| font-weight: 200; | ||
| font-style: normal; | ||
| } | ||
|
|
||
| cite :global(strong) { | ||
| color: inherit; | ||
| font-weight: 400; | ||
| font-style: italic; | ||
| } | ||
|
|
||
| cite :global(em) { | ||
| font-style: italic; | ||
| } | ||
| </style> | ||
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,20 @@ | ||
| --- | ||
| /** | ||
| * Blockquote Block for Dynamic Zones (SSR Preview) | ||
| * Passes quote as plain text, converts source markdown to HTML | ||
| */ | ||
|
|
||
| import Blockquote from '../blockquote/Blockquote.astro' | ||
| import { marked } from 'marked' | ||
|
|
||
| interface Props { | ||
| quote: string | ||
| source?: string | ||
| } | ||
|
|
||
| const { quote, source } = Astro.props | ||
|
|
||
| const htmlSource = source ? await marked.parseInline(source) : undefined | ||
| --- | ||
|
|
||
| <Blockquote quote={quote} source={htmlSource} /> |
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these 20 lines can be cleaned up with regex
something like
trimmedQuote = trimmedQuote.replace(/^["'"']|["'"']$/g, '');