-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
위젯에서 유저사이트 iframe으로 렌더링하도록 변경 (#1465)
번들 사이즈 10MB -> 7KB로 14배 감소
- Loading branch information
Showing
4 changed files
with
118 additions
and
80 deletions.
There are no files selected for viewing
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 @@ | ||
<script lang="ts"> | ||
import { css } from '@readable/styled-system/css'; | ||
import { TiptapRenderer } from '@readable/ui/tiptap'; | ||
import { graphql } from '$graphql'; | ||
const query = graphql(` | ||
query RenderPage_Query($pageId: ID!) { | ||
publicSite { | ||
id | ||
themeColor | ||
} | ||
publicPageById(pageId: $pageId) { | ||
id | ||
content { | ||
id | ||
content | ||
} | ||
} | ||
} | ||
`); | ||
</script> | ||
|
||
<div style:--usersite-theme-color={$query.publicSite.themeColor} class={css({ display: 'contents' })}> | ||
<TiptapRenderer content={$query.publicPageById.content.content} /> | ||
</div> |
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,7 @@ | ||
import type { RenderPage_Query_Variables } from './$graphql'; | ||
|
||
export const _RenderPage_Query_Variables: RenderPage_Query_Variables = ({ params }) => ({ | ||
pageId: params.id, | ||
}); | ||
|
||
export const _RenderPage_Query_Extensions = { cache: true }; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
<script lang="ts"> | ||
import { css } from '@readable/styled-system/css'; | ||
import { TiptapRenderer } from '@readable/ui/tiptap'; | ||
import { trpc } from '../trpc'; | ||
import { flex } from '@readable/styled-system/patterns'; | ||
type Props = { | ||
siteId: string; | ||
siteUrl: string; | ||
pageId: string; | ||
}; | ||
let { siteId, pageId }: Props = $props(); | ||
let { siteUrl, pageId }: Props = $props(); | ||
</script> | ||
|
||
{#await trpc.widget.page.get.query({ siteId, pageId }) then page} | ||
<div class={css({ paddingX: '16px' })}> | ||
<TiptapRenderer content={page.content} /> | ||
</div> | ||
{/await} | ||
<div class={flex({ flexGrow: '1', paddingX: '16px' })}> | ||
<iframe class={css({ flexGrow: '1', width: 'full' })} src={`${siteUrl}/r/${pageId}`} title=""></iframe> | ||
</div> |