aboutsummaryrefslogtreecommitdiff
path: root/src/components/Shifter.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/Shifter.tsx')
-rw-r--r--src/components/Shifter.tsx62
1 files changed, 44 insertions, 18 deletions
diff --git a/src/components/Shifter.tsx b/src/components/Shifter.tsx
index 601787a..36b2262 100644
--- a/src/components/Shifter.tsx
+++ b/src/components/Shifter.tsx
@@ -1,6 +1,13 @@
import React, { useState, useRef } from 'react';
import '../styles/shifter.css';
+let cssVariables = ['--titlebar-colour',
+ '--titlebar-text-colour',
+ '--titlebar-control-colour',
+ '--titlebar-control-link',
+ '--window-font',
+ '--titlebar-font']
+
export default function Shifter() {
const [sidebar, setSidebar] = useState(0);
const [position, setPosition] = useState({
@@ -18,14 +25,27 @@ export default function Shifter() {
}
+ function resetSettings() {
+ cssVariables.map((x) => {
+ localStorage.removeItem(x);
+ document.documentElement.style.removeProperty(x);
+ });
+ }
+
function closeButton() {
}
function testOption() {
console.log('Colour changed to red')
- var r = document.querySelector(':root');
- r.style.setProperty('--titlebar-colour', 'red');
+
+ document.documentElement.style.setProperty(
+ '--titlebar-colour',
+ 'red'
+ );
+
+ localStorage.setItem("--titlebar-colour", "red");
+
}
const handleMouseDown = (e: React.MouseEvent) => {
@@ -66,19 +86,19 @@ export default function Shifter() {
return (
<>
<div className="shifter-welcome">
- <h1 style={{ fontSize: 30, margin: 0 }}>Welcome to the Shifter!</h1>
- <p style={{ fontSize: 14 }}>The shifter is an application that allows you to modify various features in ShiftOS.
+ <h1>Welcome to the Shifter!</h1>
+ <p>The shifter is an application that allows you to modify various features in ShiftOS.
Initially the user interface of ShiftOS is very dull however you can use the Shifter and
various sub programs within the Shifter such as the "Colour Picker" to improve the
appearance of ShiftOS.</p>
- <p style={{ fontSize: 14 }}>The basic process of modifying your ShiftOS interface is very simple. You first choose a
+ <p>The basic process of modifying your ShiftOS interface is very simple. You first choose a
main category on the left which will bring up a list of sub categories. Next select a
sub category to display your list of customization options. Once you have modified the
appropriate settings click Apply Changes to confirm your choices.</p>
</div>
<div className="shifter-codepoints">
- <h2 style={{ fontSize: 20, margin: 0 }}>You can earn codepoints using the Shifter!</h2>
- <p style={{ fontSize: 15 }}>That's right! Simply by customizing your ShiftOS interface you can earn as many
+ <h2>You can earn codepoints using the Shifter!</h2>
+ <p>That's right! Simply by customizing your ShiftOS interface you can earn as many
codepoints as you like. The amount of codepoints you earn will be calculated and
displayed the moment you press "Apply Changes". The more time you spend customizing the
more codepoints you will earn!</p>
@@ -89,14 +109,19 @@ export default function Shifter() {
return (
<>
<div>
- Window Preview
+ <div className="window" style={{ paddingBottom: 130 }}>
+ <div className="titlebar">
+ <div className="titlebar-text">Template</div>
+ <div className="titlebar-buttons"></div>
+ </div>
+ </div>
</div>
<div className="shifter-window-sidebar">
<div className="shifter-window-buttons">
- <a onClick={() => console.log("Title Bar")}>Title Bar</a>
- <a onClick={() => console.log("Title Text")}>Title Text</a>
- <a onClick={() => console.log("Buttons")}>Buttons</a>
- <a onClick={() => console.log("Borders")}>Borders</a>
+ <a className="shifter-button" onClick={() => console.log("Title Bar")}>Title Bar</a>
+ <a className="shifter-button" onClick={() => console.log("Title Text")}>Title Text</a>
+ <a className="shifter-button" onClick={() => console.log("Buttons")}>Buttons</a>
+ <a className="shifter-button" onClick={() => console.log("Borders")}>Borders</a>
</div>
<div>
<a onClick={() => testOption()}>Test</a>
@@ -111,7 +136,7 @@ export default function Shifter() {
<h1>Global Settings Reset!</h1>
<p>After spending hours customizing ShiftOS you may want to reset all settings to their default values so you can have a clean slate.
Remember that once you reset your settings you can't undo your actions so only do so if you truly want to abandon all the customizations you have made to ShiftOS.</p>
- <a>Reset All Settings</a>
+ <a onClick={() => resetSettings()}>Reset All Settings</a>
<p><b>Warning! A Global Reset Is Irreversible!</b></p>
</>
)
@@ -123,8 +148,7 @@ export default function Shifter() {
<>
<div className="window draggable" style={{
left: `${position.x}px`,
- top: `${position.y}px`,
- cursor: isDragging ? 'grabbing' : 'default'
+ top: `${position.y}px`
}}>
<div className="titlebar" onMouseDown={handleMouseDown}>
<div className="titlebar-text">Shifter</div>
@@ -135,10 +159,12 @@ export default function Shifter() {
<div className="content">
<div className="sidebar">
<div className="sidebar-content">
- <a className="shifter-button" onClick={() => changeSidebar(1)}>Windows</a>
- <a className="shifter-button" onClick={() => changeSidebar(2)}>Reset</a>
+ <a href="#windows" className="sidebar-button" onClick={() => changeSidebar(1)}>Windows</a>
+ <div className="sep"/>
+ <a href="#reset" className="sidebar-button" onClick={() => changeSidebar(2)}>Reset</a>
+ <div className="sep"/>
</div>
- <a onClick={() => applyButton()}>Apply Changes</a>
+ <a href="#apply" className="shifter-button" onClick={() => applyButton()}>Apply Changes</a>
</div>
<div className="shifter-body">
{sidebarContent()}