-
-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/fonsp/Pluto.jl
- Loading branch information
Showing
7 changed files
with
192 additions
and
153 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 |
---|---|---|
|
@@ -8,14 +8,16 @@ import "https://cdn.jsdelivr.net/gh/fonsp/[email protected]/lib/rebel-tag-in | |
import dialogPolyfill from "https://cdn.jsdelivr.net/npm/[email protected]/dist/dialog-polyfill.esm.min.js" | ||
import immer from "../imports/immer.js" | ||
import { useDialog } from "../common/useDialog.js" | ||
import { FeaturedCard } from "./welcome/FeaturedCard.js" | ||
|
||
/** | ||
* @param {{ | ||
* filename: String, | ||
* remote_frontmatter: Record<String,any>?, | ||
* set_remote_frontmatter: (newval: Record<String,any>) => Promise<void>, | ||
* }} props | ||
* */ | ||
export const FrontMatterInput = ({ remote_frontmatter, set_remote_frontmatter }) => { | ||
export const FrontMatterInput = ({ filename, remote_frontmatter, set_remote_frontmatter }) => { | ||
const [frontmatter, set_frontmatter] = useState(remote_frontmatter ?? {}) | ||
|
||
useEffect(() => { | ||
|
@@ -138,6 +140,19 @@ export const FrontMatterInput = ({ remote_frontmatter, set_remote_frontmatter }) | |
If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and | ||
social media. | ||
</p> | ||
<div class="card-preview"> | ||
<h2>Preview</h2> | ||
<${FeaturedCard} | ||
entry=${ | ||
/** @type {import("./welcome/Featured.js").SourceManifestNotebookEntry} */ ({ | ||
id: filename.replace(/\.jl$/, ""), | ||
hash: "xx", | ||
frontmatter, | ||
}) | ||
} | ||
disable_links=${true} | ||
/> | ||
</div> | ||
<div class="fm-table"> | ||
${entries_input(frontmatter_with_defaults, ``)} | ||
${!_.isArray(frontmatter_with_defaults.author) | ||
|
@@ -205,11 +220,13 @@ const Input = ({ value, on_value, type, id }) => { | |
} | ||
}, [input_ref.current]) | ||
|
||
const placeholder = type === "url" ? "https://..." : undefined | ||
|
||
return type === "tags" | ||
? html`<rbl-tag-input id=${id} ref=${input_ref} />` | ||
: type === "license" | ||
? LicenseInput({ ref: input_ref, id }) | ||
: html`<input type=${type} id=${id} ref=${input_ref} />` | ||
: html`<input type=${type} id=${id} ref=${input_ref} placeholder=${placeholder} />` | ||
} | ||
|
||
// https://choosealicense.com/licenses/ | ||
|
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,142 @@ | ||
:root { | ||
--card-width: 15rem; | ||
} | ||
|
||
featured-card { | ||
--card-color: hsl(var(--card-color-hue), 77%, 82%); | ||
--card-border-radius: 10px; | ||
--card-border-width: 3px; | ||
|
||
display: block; | ||
/* width: var(--card-width); */ | ||
border: var(--card-border-width) solid var(--card-color); | ||
border-radius: var(--card-border-radius); | ||
margin: 10px; | ||
padding-bottom: 0.3rem; | ||
box-shadow: 0px 2px 6px 0px #00000014; | ||
font-family: var(--inter-ui-font-stack); | ||
position: relative; | ||
word-break: break-word; | ||
hyphens: auto; | ||
background: var(--index-card-bg); | ||
max-width: var(--card-width); | ||
} | ||
|
||
featured-card .banner img { | ||
--zz: calc(var(--card-border-radius) - var(--card-border-width)); | ||
width: 100%; | ||
/* height: 8rem; */ | ||
aspect-ratio: 3/2; | ||
object-fit: cover; | ||
/* background-color: hsl(16deg 100% 66%); */ | ||
background: var(--card-color); | ||
border-radius: var(--zz) var(--zz) 0 0; | ||
flex: 1 1 200px; | ||
min-width: 0; | ||
} | ||
|
||
featured-card a { | ||
text-decoration: none; | ||
/* font-weight: 800; */ | ||
} | ||
|
||
featured-card a.banner { | ||
display: flex; | ||
} | ||
|
||
featured-card .author { | ||
font-weight: 600; | ||
} | ||
|
||
featured-card .author { | ||
position: absolute; | ||
top: 0.3em; | ||
right: 0.3em; | ||
background: var(--welcome-card-author-backdrop); | ||
/* background: hsl(var(--card-color-hue) 34% 46% / 59%); */ | ||
backdrop-filter: blur(15px); | ||
color: black; | ||
border-radius: 117px; | ||
/* height: 2.5em; */ | ||
padding: 0.3em; | ||
padding-right: 0.8em; | ||
display: flex; | ||
} | ||
|
||
featured-card .author img { | ||
--size: 1.6em; | ||
/* margin: 0.4em 0.4em; */ | ||
/* margin-bottom: -0.4em; */ | ||
width: var(--size); | ||
height: var(--size); | ||
object-fit: cover; | ||
border-radius: 100%; | ||
background: #b6b6b6; | ||
display: inline-block; | ||
overflow: hidden; | ||
} | ||
|
||
featured-card .author a { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
gap: 0.4ch; | ||
} | ||
|
||
featured-card h3 a { | ||
padding: 0.6em; | ||
padding-bottom: 0; | ||
-webkit-line-clamp: 2; | ||
display: inline-block; | ||
display: -webkit-inline-box; | ||
-webkit-box-orient: vertical; | ||
overflow: hidden; | ||
background: var(--index-card-bg); | ||
border-radius: 0.6em; | ||
/* border-top-left-radius: 0; */ | ||
} | ||
|
||
featured-card p { | ||
margin: 0.3rem 0.8rem; | ||
/* padding-top: 0; */ | ||
/* margin-block: 0; */ | ||
color: #838383; | ||
-webkit-line-clamp: 4; | ||
display: inline-block; | ||
display: -webkit-inline-box; | ||
-webkit-box-orient: vertical; | ||
overflow: hidden; | ||
} | ||
|
||
featured-card h3 { | ||
margin: -1.1rem 0rem 0rem 0rem; | ||
} | ||
|
||
featured-card.big { | ||
grid-column-end: span 2; | ||
grid-row-end: span 2; | ||
/* width: 2000px; */ | ||
} | ||
|
||
featured-card.big .banner img { | ||
height: 16rem; | ||
} | ||
|
||
featured-card.special::before { | ||
content: "New!"; | ||
font-size: 1.4rem; | ||
font-weight: 700; | ||
text-transform: uppercase; | ||
font-style: italic; | ||
display: block; | ||
background: #fcf492; | ||
color: #833bc6; | ||
text-shadow: 0 0 1px #ff6767; | ||
position: absolute; | ||
transform: translateY(calc(-100% - -15px)) rotate(-5deg); | ||
padding: 2px 19px; | ||
left: -9px; | ||
/* right: 51px; */ | ||
/* border: 2px solid #ffca62; */ | ||
pointer-events: none; | ||
} |
Oops, something went wrong.