-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
803 additions
and
63 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
templates/hydrogen-theme/app/components/blocks/AddToCartButtonBlock.tsx
This file contains 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
6 changes: 3 additions & 3 deletions
6
templates/hydrogen-theme/app/components/blocks/PriceBlock.tsx
This file contains 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
8 changes: 4 additions & 4 deletions
8
templates/hydrogen-theme/app/components/blocks/ShopifyDescriptionBlock.tsx
This file contains 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
8 changes: 5 additions & 3 deletions
8
templates/hydrogen-theme/app/components/blocks/ShopifyTitleBlock.tsx
This file contains 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 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
24 changes: 24 additions & 0 deletions
24
templates/hydrogen-theme/app/components/icons/IconExternal.tsx
This file contains 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,24 @@ | ||
import {cn} from '~/lib/utils'; | ||
|
||
import type {IconProps} from './Icon'; | ||
|
||
import {Icon} from './Icon'; | ||
|
||
export function IconExternal(props: IconProps) { | ||
return ( | ||
<Icon | ||
className={cn('size-5', props.className)} | ||
fill="none" | ||
stroke="currentColor" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth={2} | ||
viewBox="0 0 24 24" | ||
> | ||
<title>External</title> | ||
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" /> | ||
<polyline points="15 3 21 3 21 9" /> | ||
<line x1="10" x2="21" y1="14" y2="3" /> | ||
</Icon> | ||
); | ||
} |
This file contains 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 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
47 changes: 47 additions & 0 deletions
47
templates/hydrogen-theme/app/components/sanity/richtext/RichTextLayout.tsx
This file contains 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,47 @@ | ||
import {vercelStegaCleanAll} from '@sanity/client/stega'; | ||
import {cx} from 'class-variance-authority'; | ||
|
||
import type {simpleContentAlignmentValues} from '~/qroq/sections'; | ||
|
||
import { | ||
contentPosition, | ||
textAlignment, | ||
} from '~/components/cva/contentAlignment'; | ||
|
||
type AlignmentValues = (typeof simpleContentAlignmentValues)[number]; | ||
|
||
export function RichtextLayout(props: { | ||
children: React.ReactNode; | ||
contentAligment?: AlignmentValues | null; | ||
desktopContentPosition?: AlignmentValues | null; | ||
maxWidth?: null | number; | ||
}) { | ||
const style = { | ||
'--maxWidth': props.maxWidth ? `${props.maxWidth}px` : 'auto', | ||
} as React.CSSProperties; | ||
|
||
const cleanContentAlignement = vercelStegaCleanAll(props.contentAligment); | ||
const cleanContentPosition = vercelStegaCleanAll( | ||
props.desktopContentPosition, | ||
); | ||
|
||
return ( | ||
<div | ||
className={cx([ | ||
textAlignment({ | ||
required: cleanContentAlignement, | ||
}), | ||
contentPosition({ | ||
required: cleanContentPosition, | ||
}), | ||
'max-w-[var(--maxWidth)] space-y-2 overflow-hidden', | ||
'[&_blockquote]:border-l-2 [&_blockquote]:pl-6 [&_blockquote]:italic', | ||
'[&_ul>li]:mt-2 [&_ul]:list-inside [&_ul]:list-disc', | ||
'[&_ol>li]:mt-2 [&_ol]:list-inside [&_ol]:list-decimal', | ||
])} | ||
style={style} | ||
> | ||
{props.children} | ||
</div> | ||
); | ||
} |
27 changes: 27 additions & 0 deletions
27
templates/hydrogen-theme/app/components/sanity/richtext/components/ButtonBlock.tsx
This file contains 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,27 @@ | ||
import type {TypeFromSelection} from 'groqd'; | ||
|
||
import type {BUTTON_BLOCK_FRAGMENT} from '~/qroq/blocks'; | ||
|
||
import {Button} from '~/components/ui/Button'; | ||
|
||
import {SanityInternalLink} from '../../link/SanityInternalLink'; | ||
|
||
export type ButtonBlockProps = TypeFromSelection<typeof BUTTON_BLOCK_FRAGMENT>; | ||
|
||
export function ButtonBlock(props: ButtonBlockProps) { | ||
return ( | ||
<Button asChild> | ||
<SanityInternalLink | ||
data={{ | ||
_key: props._key, | ||
_type: 'internalLink', | ||
anchor: props.anchor, | ||
link: props.link, | ||
name: null, | ||
}} | ||
> | ||
{props.label} | ||
</SanityInternalLink> | ||
</Button> | ||
); | ||
} |
33 changes: 33 additions & 0 deletions
33
...lates/hydrogen-theme/app/components/sanity/richtext/components/ExternalLinkAnnotation.tsx
This file contains 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,33 @@ | ||
import type {TypeFromSelection} from 'groqd'; | ||
|
||
import type {EXTERNAL_LINK_BLOCK_ANNOTATION_FRAGMENT} from '~/qroq/blocks'; | ||
|
||
import {IconExternal} from '~/components/icons/IconExternal'; | ||
import {cn} from '~/lib/utils'; | ||
|
||
import {SanityExternalLink} from '../../link/SanityExternalLink'; | ||
import {richTextLinkClassName} from './InternalLinkAnnotation'; | ||
|
||
export type ExternalLinkAnnotationProps = TypeFromSelection< | ||
typeof EXTERNAL_LINK_BLOCK_ANNOTATION_FRAGMENT | ||
>; | ||
|
||
export function ExternalLinkAnnotation( | ||
props: ExternalLinkAnnotationProps & {children: React.ReactNode}, | ||
) { | ||
return ( | ||
<SanityExternalLink | ||
className={cn(richTextLinkClassName, 'inline-flex items-center gap-1')} | ||
data={{ | ||
_key: props._key, | ||
_type: 'externalLink', | ||
link: props.link, | ||
name: null, | ||
openInNewTab: props.openInNewTab, | ||
}} | ||
> | ||
{props.children} | ||
{props.openInNewTab && <IconExternal className="size-3" />} | ||
</SanityExternalLink> | ||
); | ||
} |
Oops, something went wrong.