-
-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UX] CustomCSS field for advance persistent styling (#4282)
CustomCSS field for advance persistent styling Co-authored-by: Flávio Fearn <[email protected]>
- Loading branch information
1 parent
60afb3c
commit 78151d5
Showing
12 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,6 @@ | |
<body> | ||
<div id="root"></div> | ||
<div class="simple-keyboard"></div> | ||
<style id="customCSS"></style> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React, { ChangeEvent } from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import useSetting from 'frontend/hooks/useSetting' | ||
|
||
const CustomCSS = () => { | ||
const { t } = useTranslation() | ||
const [customCSS, setCustomCSS] = useSetting('customCSS', '') | ||
|
||
const handleCustomCSS = (event: ChangeEvent<HTMLTextAreaElement>) => { | ||
setCustomCSS(event.currentTarget.value) | ||
window.setCustomCSS(event.currentTarget.value) | ||
} | ||
|
||
return ( | ||
<> | ||
<h3>{t('settings.custom_css.title', 'Custom CSS Style')}</h3> | ||
|
||
<textarea | ||
defaultValue={customCSS} | ||
className="customCSSArea" | ||
onChange={handleCustomCSS} | ||
rows={5} | ||
/> | ||
<div className="customCSSWarning"> | ||
{t( | ||
'setting.custom_css.warning', | ||
"Warning: this applies to the whole frontend. That means the wrong style can render Heroic unusable. If needed, the setting can be changes manually in `~/.config/heroic/config.json`. Do NOT copy styles from sources you don't trust." | ||
)} | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default CustomCSS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters