-
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.
Create initial Gallery View with Emoji Plugin Example
- Loading branch information
Showing
9 changed files
with
196 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"snippets": {}, | ||
"description": "@generated" | ||
} |
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,48 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import Link from '@docusaurus/Link'; | ||
import Heading from '@theme/Heading'; | ||
import clsx from 'clsx'; | ||
import React from 'react'; | ||
|
||
import styles from './styles.module.css'; | ||
|
||
function getCardImage(item) { | ||
return ( | ||
item.preview ?? | ||
`https://slorber-api-screenshot.netlify.app/${encodeURIComponent( | ||
item.uri, | ||
)}/showcase` | ||
); | ||
} | ||
|
||
function Card({item}) { | ||
const image = getCardImage(item); | ||
return ( | ||
<li key={item.title} className="card shadow--md"> | ||
<a href={item.uri} target="_blank"> | ||
<div className={clsx('card__image', styles.showcaseCardImage)}> | ||
<img src={image} alt={item.title} /> | ||
</div> | ||
</a> | ||
<div className="card__body"> | ||
<div className={clsx(styles.showcaseCardHeader)}> | ||
<Heading as="h4" className={styles.showcaseCardTitle}> | ||
<Link href={item.website} className={styles.showcaseCardLink}> | ||
{item.title} | ||
</Link> | ||
</Heading> | ||
</div> | ||
<p className={styles.showcaseCardBody}>{item.description}</p> | ||
</div> | ||
</li> | ||
); | ||
} | ||
|
||
export default React.memo(Card); |
38 changes: 38 additions & 0 deletions
38
packages/lexical-website/src/components/Gallery/GalleryCards.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,38 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | ||
import clsx from 'clsx'; | ||
|
||
import Card from './Card'; | ||
import {plugins} from './pluginList'; | ||
import styles from './styles.module.css'; | ||
|
||
function CardList({cards}) { | ||
return ( | ||
<div className="container"> | ||
<ul className={clsx('clean-list', styles.cardList)}> | ||
{cards.map((item) => ( | ||
<Card key={item.title} item={item} /> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
} | ||
|
||
export default function GalleryCards() { | ||
const { | ||
siteConfig: {customFields}, | ||
} = useDocusaurusContext(); | ||
|
||
return ( | ||
<section className="margin-top--lg margin-bottom--xl"> | ||
<CardList cards={plugins(customFields)} /> | ||
</section> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/lexical-website/src/components/Gallery/GalleryPage.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,17 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import GalleryCards from './GalleryCards'; | ||
|
||
export default function GalleryPage() { | ||
return ( | ||
<main className="margin-vert--lg"> | ||
<GalleryCards /> | ||
</main> | ||
); | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/lexical-website/src/components/Gallery/pluginList.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,14 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
export const plugins = (customFields) => [ | ||
{ | ||
title: 'EmojiPlugin', | ||
uri: `${customFields.STACKBLITZ_PREFIX}examples/vanilla-js-plugin?embed=1&file=src%2Femoji-plugin%2FEmojiPlugin.ts&terminalHeight=0&ctl=1`, | ||
}, | ||
]; |
68 changes: 68 additions & 0 deletions
68
packages/lexical-website/src/components/Gallery/styles.module.css
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,68 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
.cardList { | ||
display: grid; | ||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); | ||
gap: 24px; | ||
} | ||
|
||
.showcaseFavorite { | ||
padding-top: 2rem; | ||
padding-bottom: 2rem; | ||
background-color: #f6fdfd; | ||
} | ||
|
||
html[data-theme='dark'] .showcaseFavorite { | ||
background-color: #232525; | ||
} | ||
|
||
.headingFavorites { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.showcaseCardImage { | ||
overflow: hidden; | ||
height: 150px; | ||
border-bottom: 2px solid var(--ifm-color-emphasis-200); | ||
} | ||
|
||
.showcaseCardHeader { | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 12px; | ||
} | ||
|
||
.showcaseCardTitle { | ||
margin-bottom: 0; | ||
flex: 1 1 auto; | ||
} | ||
|
||
.showcaseCardTitle a { | ||
text-decoration: none; | ||
background: linear-gradient( | ||
var(--ifm-color-primary), | ||
var(--ifm-color-primary) | ||
) | ||
0% 100% / 0% 1px no-repeat; | ||
transition: background-size ease-out 200ms; | ||
} | ||
|
||
.showcaseCardTitle a:not(:focus):hover { | ||
background-size: 100% 1px; | ||
} | ||
|
||
.showcaseCardTitle, | ||
.showcaseCardHeader { | ||
margin-right: 0.25rem; | ||
} | ||
|
||
.showcaseCardBody { | ||
font-size: smaller; | ||
line-height: 1.66; | ||
} |
This file was deleted.
Oops, something went wrong.
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