-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Support description markdown and longer length (#385)
Fixes #381 ## Changes - Renders description as markdown - Shows "Collection name" and "About this collection" labels when description is present - Fixes overflow issue where bottom few pixels of embed is cut off - Hides description in mobile view Co-authored-by: emma <[email protected]>
- Loading branch information
Showing
7 changed files
with
345 additions
and
14 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,61 @@ | ||
import { css, LitElement } from "lit"; | ||
import { customElement, property } from "lit/decorators.js"; | ||
import { html as staticHtml, unsafeStatic } from "lit/static-html.js"; | ||
import { micromark } from "micromark"; | ||
import { | ||
gfmStrikethrough, | ||
gfmStrikethroughHtml, | ||
} from "micromark-extension-gfm-strikethrough"; | ||
|
||
@customElement("wr-coll-description") | ||
export class CollectionDescription extends LitElement { | ||
static styles = [ | ||
css` | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
h5, | ||
h6 { | ||
font-size: 1rem; | ||
} | ||
a { | ||
color: var(--link); | ||
} | ||
a:hover, | ||
a:active { | ||
text-decoration: none; | ||
} | ||
img { | ||
max-width: 100%; | ||
} | ||
p { | ||
line-height: inherit; | ||
} | ||
p:first-child { | ||
margin-top: 0; | ||
} | ||
p:last-child { | ||
margin-bottom: 0; | ||
} | ||
`, | ||
]; | ||
|
||
@property({ type: String }) | ||
value = ""; | ||
|
||
render() { | ||
return staticHtml`${unsafeStatic( | ||
micromark(this.value, { | ||
extensions: [gfmStrikethrough()], | ||
htmlExtensions: [gfmStrikethroughHtml()], | ||
}), | ||
)}`; | ||
} | ||
} |
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.