-
Notifications
You must be signed in to change notification settings - Fork 7
Refactored how templates are handled #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
// @see docs/custom-templates.md | ||
const templateModules = import.meta.glob("../templates/*.jsx", { eager: true }); | ||
const customTemplatesModules = import.meta.glob("../custom-templates/*.jsx", { | ||
eager: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why eager: true,
?
docs/custom-templates.md
Outdated
|
||
The following files are required for a custom template: | ||
|
||
* custom-template-name.jsx - A javascript module for the template. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess technically it is a JavaScript XML module if it is .jsx
@@ -1,7 +1,7 @@ | |||
import { React, useContext } from "react"; | |||
import PropTypes from "prop-types"; | |||
import UserContext from "./context/user-context"; | |||
import NoAccess from "./components/no-access/no-access"; | |||
import UserContext from "../context/user-context.jsx"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why .jsx
?
@@ -92,6 +93,7 @@ function SlideForm({ | |||
const [themesOptions, setThemesOptions] = useState(); | |||
const [displayPreview, setDisplayPreview] = useState(null); | |||
const [templateError, setTemplateError] = useState(false); | |||
const [disableLivePreview, setDisableLivePreview] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [disableLivePreview, setDisableLivePreview] = useState(false); | |
const [enablePreview, setEnablePreview] = useState(true); |
@@ -401,13 +394,12 @@ function SlideForm({ | |||
</Button> | |||
</div> | |||
|
|||
{selectedTemplate?.resources?.options?.disableLivePreview && ( | |||
{disableLivePreview && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{disableLivePreview && ( | |
{enablePreview && ( |
<Alert variant="secondary" className="mt-3"> | ||
{t("slide-preview-disabled-preview")} | ||
</Alert> | ||
)} | ||
{!selectedTemplate?.resources?.options?.disableLivePreview && | ||
selectedTemplate?.resources?.component && ( | ||
{!disableLivePreview && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{!disableLivePreview && ( | |
{!enablePreview && ( |
@@ -92,6 +93,7 @@ function SlideForm({ | |||
const [themesOptions, setThemesOptions] = useState(); | |||
const [displayPreview, setDisplayPreview] = useState(null); | |||
const [templateError, setTemplateError] = useState(false); | |||
const [disableLivePreview, setDisableLivePreview] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This state is never changed in the file......
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small comments, nothing big
Co-authored-by: Sine Jespersen <[email protected]>
Co-authored-by: Sine Jespersen <[email protected]>
Co-authored-by: Sine Jespersen <[email protected]>
Co-authored-by: Sine Jespersen <[email protected]>
Co-authored-by: Sine Jespersen <[email protected]>
Link to issue
#249
Description
Refactored how templates are handled:
Checklist