-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update the showcase page (#548)
* docs: update the case page * docs: i18n of showcase page * docs: extract the showcase component Co-authored-by: jiming <[email protected]>
- Loading branch information
Showing
5 changed files
with
128 additions
and
2 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
6 changes: 6 additions & 0 deletions
6
website/i18n/zh-CN/docusaurus-plugin-content-pages/case/index.js
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,6 @@ | ||
import React from 'react'; | ||
import ShowCase from '../../../../src/components/ShowCase'; | ||
|
||
export default function Case() { | ||
return <ShowCase language="zh-CN" />; | ||
} |
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,81 @@ | ||
import React from 'react'; | ||
import Layout from '@theme/Layout'; | ||
import styles from './index.module.css'; | ||
|
||
const data = [ | ||
{ | ||
name: 'molecule-demo', | ||
sourceUrl: | ||
'https://github.com/DTStack/molecule-examples/tree/main/packages/molecule-demo', | ||
previewUrl: 'https://dtstack.github.io/molecule-examples/', | ||
cnDesc: '展示如何使用 Molecule 的 demo 项目', | ||
enDesc: 'The examples showing how to integrate or use the Molecule.', | ||
}, | ||
{ | ||
name: 'online-code-formatting', | ||
sourceUrl: 'https://github.com/wewoor/online-code-formatting', | ||
previewUrl: 'https://wewoor.github.io/online-code-formatting/', | ||
cnDesc: '使用 Molecule 开发的一个简单的在线代码格式化工具', | ||
enDesc: 'A simple online code formatting tool built with Molecule.', | ||
}, | ||
{ | ||
name: 'monaco-sql-languages', | ||
sourceUrl: 'https://github.com/DTStack/monaco-sql-languages', | ||
previewUrl: 'https://dtstack.github.io/monaco-sql-languages/', | ||
cnDesc: '这是 Monaco Editor 的一个 SQL Languages 项目', | ||
enDesc: 'This is a SQL Languages project for Monaco Editor.', | ||
}, | ||
{ | ||
name: 'online-markdown-preview', | ||
sourceUrl: 'https://github.com/kiwiwong/online-markdown-preview', | ||
previewUrl: 'https://kiwiwong.github.io/online-markdown-preview/', | ||
cnDesc: '使用 Molecule 开发的一个简单的 Markdown 在线编辑预览工具', | ||
enDesc: 'A simple online markdown preview tool built with Molecule.', | ||
}, | ||
]; | ||
|
||
const CasePanel = ({ | ||
name, | ||
sourceUrl, | ||
previewUrl, | ||
cnDesc, | ||
enDesc, | ||
language, | ||
}) => ( | ||
<div className={styles.panel}> | ||
<div> | ||
<a | ||
href={previewUrl} | ||
className={styles.name} | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
{name} | ||
</a> | ||
</div> | ||
<div style={{ marginBottom: '8px' }}> | ||
<a | ||
href={sourceUrl} | ||
target="_blank" | ||
rel="noreferrer" | ||
style={{ color: 'var(--ifm-color-primary)' }} | ||
> | ||
<span className={styles.icon}></span> | ||
<span>{language === 'zh-CN' ? '源码' : 'source'}</span> | ||
</a> | ||
</div> | ||
<div>{language === 'zh-CN' ? cnDesc : enDesc}</div> | ||
</div> | ||
); | ||
|
||
export default function ShowCase({ language = 'zh-CN' }) { | ||
return ( | ||
<Layout> | ||
<div className={styles['panel-wrapper']}> | ||
{data.map((obj) => ( | ||
<CasePanel {...obj} key={obj.name} language={language} /> | ||
))} | ||
</div> | ||
</Layout> | ||
); | ||
} |
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,34 @@ | ||
.panel-wrapper { | ||
display: grid; | ||
grid-template-columns: repeat(auto-fill, 250px); | ||
row-gap: 24px; | ||
column-gap: 24px; | ||
padding: 64px; | ||
} | ||
.panel { | ||
padding: 12px 16px; | ||
font-size: 14px; | ||
box-shadow: 0px 5px 40px 0px #ddd; | ||
border-radius: 8px; | ||
background-color: var(--ifm-navbar-background-color); | ||
} | ||
.name { | ||
color: var(--ifm-color-primary); | ||
font-size: 16px; | ||
font-weight: 700; | ||
} | ||
.icon { | ||
display: inline-block; | ||
width: 16px; | ||
height: 16px; | ||
margin-right: 6px; | ||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E"); | ||
background-size: 100% 100%; | ||
vertical-align: text-bottom; | ||
} | ||
:global(html[data-theme='dark']) .panel { | ||
box-shadow: none; | ||
} | ||
:global(html[data-theme='dark']) .icon { | ||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23fff' d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E"); | ||
} |
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,6 @@ | ||
import React from 'react'; | ||
import ShowCase from '../../components/ShowCase'; | ||
|
||
export default function Case() { | ||
return <ShowCase language="en" />; | ||
} |