mirror of
https://github.com/mue/mue.git
synced 2026-07-06 16:04:20 +02:00
feat: custom font ui, fix modal css and date widget stuff
Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
@@ -10,7 +10,6 @@ export default function MainModal(props) {
|
||||
return (
|
||||
<div className='modal'>
|
||||
<span className='closeModal' onClick={props.modalClose}>×</span>
|
||||
<h1>.</h1>
|
||||
<div>
|
||||
<Navigation navbar={true}>
|
||||
<div label={props.language.modals.main.navbar.settings}>
|
||||
|
||||
@@ -36,6 +36,13 @@ export default class About extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (localStorage.getItem('offlineMode') === 'true') {
|
||||
this.setState({
|
||||
update: this.props.language.version.offline_mode
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.getGitHubData();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ export default class AppearanceSettings extends React.PureComponent {
|
||||
super(...args);
|
||||
this.state = {
|
||||
zoom: localStorage.getItem('zoom'),
|
||||
toast_duration: localStorage.getItem('toastDisplayTime')
|
||||
toast_duration: localStorage.getItem('toastDisplayTime'),
|
||||
font: localStorage.getItem('font')
|
||||
};
|
||||
}
|
||||
|
||||
@@ -29,6 +30,13 @@ export default class AppearanceSettings extends React.PureComponent {
|
||||
});
|
||||
break;
|
||||
|
||||
case 'font':
|
||||
localStorage.setItem('font', '');
|
||||
this.setState({
|
||||
font: ''
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
toast('resetItem requires a key!');
|
||||
}
|
||||
@@ -39,6 +47,7 @@ export default class AppearanceSettings extends React.PureComponent {
|
||||
componentDidUpdate() {
|
||||
localStorage.setItem('zoom', this.state.zoom);
|
||||
localStorage.setItem('toastDisplayTime', this.state.toast_duration);
|
||||
localStorage.setItem('font', this.state.font);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -49,6 +58,12 @@ export default class AppearanceSettings extends React.PureComponent {
|
||||
<h2>{appearance.title}</h2>
|
||||
<Checkbox name='darkTheme' text={appearance.dark_theme} />
|
||||
<Checkbox name='brightnessTime' text={appearance.night_mode} />
|
||||
<h3>{appearance.font.title}</h3>
|
||||
<ul>
|
||||
<p>{appearance.font.custom} <span className='modalLink' onClick={() => this.resetItem('font')}>{this.props.language.buttons.reset}</span></p>
|
||||
<input type='text' value={this.state.font} onChange={(e) => this.setState({ font: e.target.value })}></input>
|
||||
</ul>
|
||||
<Checkbox name='fontGoogle' text={appearance.font.google} />
|
||||
<h3>{appearance.accessibility.title}</h3>
|
||||
<Checkbox name='animations' text={appearance.animations} betaFeature={true} />
|
||||
<ul>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
import Dropdown from '../Dropdown';
|
||||
|
||||
const languages = require('../../../../modules/languages.json');
|
||||
|
||||
@@ -74,10 +74,13 @@ export default class TimeSettings extends React.PureComponent {
|
||||
<option className='choices' value='MDY'>MDY</option>
|
||||
<option className='choices' value='YMD'>YMD</option>
|
||||
</Dropdown>
|
||||
<br/>
|
||||
<br/>
|
||||
<Dropdown label={time.date.short_separator.title} name='shortFormat' id='shortformat' onChange={() => localStorage.setItem('shortFormat', document.getElementById('shortformat').value)}>
|
||||
<option className='choices' value='default'>{time.date.short_separator.default}</option>
|
||||
<option className='choices' value='dots'>{time.date.short_separator.dots}</option>
|
||||
<option className='choices' value='dash'>{time.date.short_separator.dash}</option>
|
||||
<option className='choices' value='gaps'>{time.date.short_separator.gaps}</option>
|
||||
<option className='choices' value='slashes'>{time.date.short_separator.slashes}</option>
|
||||
</Dropdown>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -39,13 +39,16 @@ export default class DateWidget extends React.PureComponent {
|
||||
|
||||
let format;
|
||||
switch (localStorage.getItem('shortFormat')) {
|
||||
case 'dots':
|
||||
format = `${day}.${month}.${year}`;
|
||||
break;
|
||||
case 'dash':
|
||||
format = `${day}-${month}-${year}`;
|
||||
break;
|
||||
case 'gaps':
|
||||
format = `${day} - ${month} - ${year}`;
|
||||
break;
|
||||
default:
|
||||
case 'slashes':
|
||||
format = `${day}/${month}/${year}`;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,18 +89,18 @@ export default class SettingsFunctions {
|
||||
|
||||
const font = localStorage.getItem('font');
|
||||
if (font) {
|
||||
const data = JSON.parse(font);
|
||||
const google = localStorage.getItem('fontGoogle');
|
||||
|
||||
let url = '';
|
||||
if (data.google === true) {
|
||||
url = `@import url('https://fonts.googleapis.com/css2?family=${data.name}&display=swap');`;
|
||||
if (google === 'true') {
|
||||
url = `@import url('https://fonts.googleapis.com/css2?family=${font}&display=swap');`;
|
||||
}
|
||||
|
||||
document.head.insertAdjacentHTML('beforeend', `
|
||||
<style>
|
||||
${url}
|
||||
* {
|
||||
font-family: '${data.name}', 'Lexend Deca' !important;
|
||||
font-family: '${font}', 'Lexend Deca' !important;
|
||||
}
|
||||
</style>`);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
.dropdown {
|
||||
select {
|
||||
margin-left: 10px;
|
||||
|
||||
background: linear-gradient(180deg, #ffb032 0%, #dd3b67 100%);
|
||||
height: 34px;
|
||||
width: 120px;
|
||||
|
||||
@@ -209,7 +209,7 @@ li {
|
||||
.tab-content {
|
||||
position: absolute;
|
||||
left: 25%;
|
||||
width: 60%;
|
||||
top: 10%;
|
||||
|
||||
h3 {
|
||||
text-transform: uppercase;
|
||||
@@ -219,7 +219,7 @@ li {
|
||||
@media only screen and (max-width: 1920px) {
|
||||
.tab-content {
|
||||
position: absolute;
|
||||
left: 35%;
|
||||
left: 30%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,10 @@
|
||||
"short_format": "Short Format",
|
||||
"short_separator": {
|
||||
"title": "Short Separator",
|
||||
"default": "Dots (.)",
|
||||
"dash": "Dash (-)",
|
||||
"gaps": "Gaps ( )"
|
||||
"dots": "Dots",
|
||||
"dash": "Dash",
|
||||
"gaps": "Gaps",
|
||||
"slashes": "Slashes"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -109,6 +110,11 @@
|
||||
"dark_theme": "Dark Theme",
|
||||
"night_mode": "Night Mode",
|
||||
"animations": "Animations",
|
||||
"font": {
|
||||
"title": "Font",
|
||||
"custom": "Custom Font",
|
||||
"google": "Import from Google Fonts"
|
||||
},
|
||||
"accessibility": {
|
||||
"title": "Accessibility",
|
||||
"zoom": "Zoom",
|
||||
@@ -140,7 +146,8 @@
|
||||
"title": "Version",
|
||||
"checking_update": "Checking for update",
|
||||
"update_available": "Update available",
|
||||
"no_update": "No update available"
|
||||
"no_update": "No update available",
|
||||
"offline_mode": "Cannot check for update in offline mode"
|
||||
},
|
||||
"resources_used": {
|
||||
"title": "Resources Used",
|
||||
|
||||
Reference in New Issue
Block a user