-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
feat(theme): add themes #1954
base: master
Are you sure you want to change the base?
feat(theme): add themes #1954
Conversation
@@ -11,7 +12,7 @@ export default (model: IPlayerModel): string => `<!doctype html> | |||
${model.scripts | |||
.map((script) => `<script src="${script}"></script>`) | |||
.join('\n ')} | |||
|
|||
<style>${generateThemeCSS(model.theme)}</style> |
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.
The theme should be optional
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.
It is optional. When the theme is not defined it returns an empty string.
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.
On second thought I think the way to inject the theme with the global custom style is better, as it doesn‘t require changes in the client and it will also work with the iframe embed type.
@@ -15,5 +15,16 @@ | |||
"H5P.CoursePresentation": ["H5P.MathDisplay"], | |||
"H5P.InteractiveVideo": ["H5P.MathDisplay"], | |||
"H5P.DragQuestion": ["H5P.MathDisplay"] | |||
}, | |||
"theme": { |
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.
Further customization options could be:
- corner rounding other button decorations
- font sizes and font faces
- margins and paddings
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 already planed to add those.
packages/h5p-server/src/H5PEditor.ts
Outdated
this.globalCustomStyles = | ||
this.options?.customization?.global?.styles || []; | ||
this.globalCustomStyles = this.options?.customization?.global | ||
?.styles || [ |
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.
The theme should not replace the global styles; they should be concatenated I guess
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.
It is not replaced but entered as the first entry in the array .
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.
Really? From what I see it takes the global styles and if it is undefined it now takes the theme. They are not combined. The && doesn‘t work here, as this only works in React.
packages/h5p-server/src/types.ts
Outdated
fontColor: string; | ||
disabledFontColor: string; | ||
backgroundColor: string; | ||
paperBackgroundColor: string; |
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.
"paper" is a Material UI term; is there a more generic term?
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.
secondaryBackground?
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.
Ok
It would also make sense to accomodate scenarios in which you have a per-content object theme that is configurable by the content author. |
} from '../expressErrorHandler'; | ||
|
||
/** | ||
* This router implements all Ajax calls necessary for the H5P (editor) client to work. |
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.
Description is not correct
packages/h5p-server/src/types.ts
Outdated
@@ -2089,3 +2092,24 @@ export interface ILockProvider { | |||
options: { timeout: number; maxOccupationTime: number } | |||
): Promise<T>; | |||
} | |||
|
|||
export interface ITheme { | |||
themeUrl: string; |
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 property is used nowhere else? What is its function?
I've fixed most of the issues above in the editor. There's mostly work to be done in the course presentation editor (it's various submenus). I've noticed that it seems like a bad idea to override the I haven't really looked at the player yet. |
I've reviewed the state of the theme in the player and I think the approach of the PR isn't working out. Nearly all content types are broken in some way. I've reviewed about 40% (results below) I suggest this:
@JPSchellenberg @jankapunkt What do you think of this approach? |
Wow, @sr258 you made an effort here. From my perspective this sounds good, especially with the scoping. We also use scss but I wonder if there are people who use just css or things like tailwind. Can they still use the theming then? |
Yes, the theme builder compiles it to css. |
No description provided.