Skip to content

Commit

Permalink
💄 Live page | Fix red-coloured text (#1836)
Browse files Browse the repository at this point in the history
* tina-schema-json

* Add string field in live page collection

* tina.json

* Updated page content using title and subtitle

* Use dangerouslySetInnerHTML to set color to red

* Removed comments

* PR review - remove bold text to red text feature
  • Loading branch information
jeoffreyfischer authored Dec 7, 2023
1 parent 5016437 commit ffa285c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .tina/__generated__/_graphql.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .tina/__generated__/_schema.json

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions .tina/collections/live.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ export const liveSchema: Collection = {
// @ts-ignore
seoSchema,
{
type: "rich-text",
isBody: true,
type: "string",
name: "title",
label: "Title",
},
{
type: "rich-text",
isBody: true,
name: "subtitle",
label: "Subtitle",
templates: [...Schemas.pageBlocks],
description: "Tip: Bold text is turned into Red color",
},
{
type: "string",
Expand Down
16 changes: 12 additions & 4 deletions components/live/header.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import classNames from "classnames";
import { TinaMarkdown, TinaMarkdownContent } from "tinacms/dist/rich-text";
import { sanitiseXSS, spanWhitelist } from "../../helpers/validator";
import { Container } from "../util/container";

type LiveHeaderprops = {
title: TinaMarkdownContent;
title: string;
subtitle: TinaMarkdownContent;
};

export const LiveHeader = (props: LiveHeaderprops) => {
const { title } = props;
const { title, subtitle } = props;
return (
<section
className={classNames(
Expand All @@ -26,8 +28,14 @@ export const LiveHeader = (props: LiveHeaderprops) => {
"flex flex-row items-center max-md:justify-center"
)}
></div>
<div className="mb-2 pb-1 pt-3 text-5xl child-h1:text-5xl child-h1:font-semibold child-p:text-xl descendant-strong:font-semibold descendant-strong:text-sswRed">
{<TinaMarkdown content={title} />}
<h1
className="text-5xl font-semibold"
dangerouslySetInnerHTML={{
__html: sanitiseXSS(title, spanWhitelist) || "",
}}
></h1>
<div className="mb-2 pb-1 pt-3 child-h1:text-5xl child-h1:font-semibold child-p:text-xl">
{<TinaMarkdown content={subtitle} />}
</div>
<div
className={classNames(
Expand Down
3 changes: 1 addition & 2 deletions content/live/index.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
title: SSW <span class="text-sswRed">Live</span> Stream Channel
nextEvent: Upcoming Session Details
sswTvButton:
name: Visit SSW TV Channel on Youtube
Expand All @@ -9,8 +10,6 @@ youtubePlaylistButton:
playlistId: PLpiOR7CBNvlpmhfwQeIVhbqZKxV-do0wY
---

# SSW **Live** Stream Channel

User Group Live

Every 3rd Wednesday of the month at 6.30PM (Sydney time)
Expand Down
2 changes: 1 addition & 1 deletion pages/live.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function LivePage(
return (
<Layout menu={data.megamenu}>
<SEO seo={data.live.seo} />
<LiveHeader title={data.live.title} />
<LiveHeader title={data.live.title} subtitle={data.live.subtitle} />
<Section className="mx-auto w-full max-w-9xl px-8 py-5">
<Breadcrumbs
path={removeExtension(props.variables.relativePath)}
Expand Down

0 comments on commit ffa285c

Please sign in to comment.