Skip to content

Commit

Permalink
fix: remove automatic injection of the subscription page
Browse files Browse the repository at this point in the history
  • Loading branch information
jeangovil committed Dec 19, 2023
1 parent b213075 commit d7e8b64
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import {
Toast,
Typography,
} from '@acid-info/lsd-react'
import Layout from '@theme/Layout'
import Link from '@docusaurus/Link'
import ThemedImage from '@theme/ThemedImage'
import React from 'react'
import { useNewsletterApi } from '../../lib/useNewsletterApi'
import { useThemeOptions } from '../../lib/useThemeOptions'
import styles from './SubscriptionPage.module.scss'
import Link from '@docusaurus/Link'

export type SubscriptionPageProps = {}

Expand All @@ -31,69 +30,67 @@ export const SubscriptionPage: React.FC<SubscriptionPageProps> = ({}) => {
}

return (
<Layout>
<div className={styles.container}>
<div className={styles.root}>
<div className={styles.header}>
<ThemedImage
sources={{
dark: '/theme/image/horizontal_lockup_small_white.svg',
light: '/theme/image/horizontal_lockup_small_black.svg',
}}
height={88}
/>
<Typography component="p">Subscribe to our newsletter</Typography>
</div>
{api.message && (
<Toast
size="medium"
title={api.message}
icon={api.error ? ErrorIcon : CheckIcon}
className={styles.toast}
/>
)}
{api.error && api.message && <div></div>}
{displayForm && (
<form className={styles.form} onSubmit={onSubmit}>
<div className={styles.inputs}>
<TextField
inputProps={{
name: 'name',
type: 'text',
required: false,
}}
size="medium"
variant="underlined"
placeholder="First name or pseudonym"
/>
<TextField
inputProps={{
name: 'email',
type: 'email',
required: true,
}}
size="medium"
variant="underlined"
placeholder="Email address (required)"
/>
</div>
<div className={styles.submit}>
<Button variant="filled" disabled={api.busy}>
Subscribe
</Button>
</div>
</form>
)}
{!displayForm && (
<div className={styles.toHome}>
<Link href="/">
<Button variant="filled">To home page</Button>
</Link>
</div>
)}
<div className={styles.container}>
<div className={styles.root}>
<div className={styles.header}>
<ThemedImage
sources={{
dark: '/theme/image/horizontal_lockup_small_white.svg',
light: '/theme/image/horizontal_lockup_small_black.svg',
}}
height={88}
/>
<Typography component="p">Subscribe to our newsletter</Typography>
</div>
{api.message && (
<Toast
size="medium"
title={api.message}
icon={api.error ? ErrorIcon : CheckIcon}
className={styles.toast}
/>
)}
{api.error && api.message && <div></div>}
{displayForm && (
<form className={styles.form} onSubmit={onSubmit}>
<div className={styles.inputs}>
<TextField
inputProps={{
name: 'name',
type: 'text',
required: false,
}}
size="medium"
variant="underlined"
placeholder="First name or pseudonym"
/>
<TextField
inputProps={{
name: 'email',
type: 'email',
required: true,
}}
size="medium"
variant="underlined"
placeholder="Email address (required)"
/>
</div>
<div className={styles.submit}>
<Button variant="filled" disabled={api.busy}>
Subscribe
</Button>
</div>
</form>
)}
{!displayForm && (
<div className={styles.toHome}>
<Link href="/">
<Button variant="filled">To home page</Button>
</Link>
</div>
)}
</div>
</Layout>
</div>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export type ThemeOptions = DefaultPluginOptions & {
docs?: Record<string, DocConfig>
typography?: GlobalTypographyStyles
newsletterSubscription?: {
pagePath?: string
mailingListId: number
}
}
6 changes: 0 additions & 6 deletions packages/logos-docusaurus-theme/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ export default function logosTheme(

async contentLoaded(args) {
await createAuthorRoutes(context, args)
if (options.newsletterSubscription)
args.actions.addRoute({
path: options.newsletterSubscription.pagePath || '/subscribe',
component: path.resolve(__dirname, './client/theme/SubscriptionPage'),
exact: true,
})
},

injectHtmlTags: ({}) => {
Expand Down

0 comments on commit d7e8b64

Please sign in to comment.