Skip to content

Commit

Permalink
blockquotes
Browse files Browse the repository at this point in the history
  • Loading branch information
bskp committed Sep 10, 2023
1 parent 4bfb617 commit e1ce755
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
23 changes: 11 additions & 12 deletions app/imports/ui/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ interface SidebarProps {

export const Sidebar = (props: SidebarProps) => {
const [filter, setFilter] = useState('');
const { trackSiteSearch } = useMatomo();
const {trackSiteSearch} = useMatomo();

function getFilterTogglingCallback(term: string) {
return () => setFilter(filter => {
if (filter.includes(term)) {
return filter
.replaceAll(term, " ")
.replaceAll(/#? +/g, " ")
.trim();
.replaceAll(term, " ")
.replaceAll(/#? +/g, " ")
.trim();
} else {
return (filter.trim() + " #" + term).trim()
}
Expand Down Expand Up @@ -61,6 +61,10 @@ export const Sidebar = (props: SidebarProps) => {
};

let input = useRef<HTMLInputElement>(null)
const introCreateNew = <>
<li key="intro"><NavLink to="/">Einführung</NavLink></li>
<li key="create"><NavLink to="/create">Neues Rezept…</NavLink></li>
</>

return <aside id="sidebar">
<div id="filter">
Expand All @@ -81,14 +85,9 @@ export const Sidebar = (props: SidebarProps) => {
</div>
<div id="lists">
<Taglist activeTags={props.rezept?.tagNames} togglerCallbackFactory={getFilterTogglingCallback}/>
<ul id="rezepte" >
<li key="intro">
<NavLink to="/">Einführung</NavLink>
</li>
<li key="create">
<NavLink to="/create">Neues Rezept…</NavLink>
</li>
<hr />
<ul id="rezepte">
{filter == '' ? introCreateNew : undefined}
<hr/>
{filtered.map(rezept =>
<li key={rezept._lineage}>
<NavLink to={'/' + rezept.slug}>{rezept.name}</NavLink>
Expand Down
4 changes: 4 additions & 0 deletions app/imports/ui/recipe-schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ const schema = {
},
paragraphRule,
listRule,
{
matchMdast: matchType('blockquote'),
component: ({children}) => <em>{children}</em>,
},
{
matchMdast: matchType("ingredientList"),
component: ({children}) => <ul className="ingredients">{children}</ul>,
Expand Down

0 comments on commit e1ce755

Please sign in to comment.