-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
website: markdown support snack preview button.
- Loading branch information
1 parent
ea57d4c
commit 189b4cf
Showing
3 changed files
with
131 additions
and
13 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,55 @@ | ||
|
||
import { ReactComponent as LinkSVG } from '../SubMenus/link.svg'; | ||
import styles from './index.module.less'; | ||
|
||
export interface SnackPlayerProps { | ||
platform?: 'android' | 'web' | 'ios' | 'mydevice' | ||
theme?: 'light' | 'dark'; | ||
buttonTitle?: string; | ||
preview?: boolean; | ||
name?: string; | ||
sdkVersion?: string; | ||
description?: string; | ||
loading?: 'auto' | 'lazy' | 'eager'; | ||
dependencies?: string; | ||
templateId?: string; | ||
contentHidden?: boolean; | ||
/** | ||
* ```js | ||
* { | ||
* "AppTest.js": { | ||
* "type": "CODE", | ||
* "contents": "console.log(\"www\")" | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
files?: string; | ||
} | ||
|
||
export function SnackPlayer(props: SnackPlayerProps) { | ||
const { | ||
platform = 'web', | ||
buttonTitle = 'Try this Example on Snack', | ||
name = 'Example', | ||
sdkVersion = '42.0.0', | ||
dependencies = '@uiw/react-native@2.2.0,react-native-svg', | ||
files = '{}', | ||
} = props; | ||
|
||
return ( | ||
<form action="https://snack.expo.dev" method="POST" target="_blank"> | ||
<input type="hidden" name="platform" value={platform} /> | ||
<input type="hidden" name="name" value={name} /> | ||
{dependencies && <input type="hidden" name="dependencies" value={dependencies} />} | ||
<input type="hidden" name="sdkVersion" value={sdkVersion} /> | ||
<input type="hidden" name="files" value={files} /> | ||
<button className={styles.button}> | ||
<LinkSVG | ||
fill="currentColor" | ||
/> | ||
{buttonTitle} | ||
</button> | ||
</form> | ||
); | ||
} |
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,3 +1,26 @@ | ||
.warpper { | ||
padding: 36px 33px 30px 33px; | ||
} | ||
|
||
.button { | ||
display: grid; | ||
grid-template-columns: 8px 1fr; | ||
grid-gap: 8px; | ||
align-items: center; | ||
border: none; | ||
border-radius: 4px; | ||
padding: 0 6px; | ||
height: 22px; | ||
margin: 18px 0 -8px 18px; | ||
text-decoration: none; | ||
background: #2196f3; | ||
color: #fff; | ||
font-family: expo-brand-book; | ||
font-size: 12px; | ||
cursor: pointer; | ||
transition: all .3s; | ||
&:hover { | ||
background: #3f51b5; | ||
color: #fff; | ||
} | ||
} |
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