-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from cmgriffing/feat/saved-snippets
feat: get saved snippets working
- Loading branch information
Showing
13 changed files
with
225 additions
and
48 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
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
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 { Highlighter } from 'shiki' | ||
import { ShikiMagicMove } from 'shiki-magic-move/solid' | ||
import { Snippet } from '~/types' | ||
|
||
interface SnippetPreviewProps { | ||
highlighter: Highlighter | ||
snippet: Snippet | ||
} | ||
|
||
export function SnippetPreview(props: SnippetPreviewProps) { | ||
return ( | ||
<div | ||
class="w-32 h-32 flex items-center justify-center" | ||
style={{ | ||
background: props.snippet.bgColor, | ||
// padding: `${props.snippet.yPadding}px ${props.snippet.xPadding}px`, | ||
}} | ||
> | ||
<ShikiMagicMove | ||
class="p-4 shadow-xl rounded select-none overflow-hidden h-24 w-24" | ||
highlighter={props.highlighter} | ||
lang={props.snippet.language} | ||
code={props.snippet.codeLeft} | ||
theme={props.snippet.theme} | ||
options={{ | ||
duration: 800, | ||
stagger: 0, | ||
lineNumbers: false, | ||
}} | ||
/> | ||
</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
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
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
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
Oops, something went wrong.