+ {!Array.isArray(children)
+ ? children
+ : children.map((c, i, arr) => (
+ <>
+ {c}
+
+ >
+ ))}
+
);
-export const PreferencesPane: FunctionComponent = () => {
- const store = new MockState();
- return (
-
-
+export const PreferencesPane: FunctionalComponent = ({ children }) => (
+
+);
diff --git a/app/assets/javascripts/components/preferences/mock-state.ts b/app/assets/javascripts/components/preferences/preferences.ts
similarity index 78%
rename from app/assets/javascripts/components/preferences/mock-state.ts
rename to app/assets/javascripts/components/preferences/preferences.ts
index dd018f243b2..3a7407d4a5c 100644
--- a/app/assets/javascripts/components/preferences/mock-state.ts
+++ b/app/assets/javascripts/components/preferences/preferences.ts
@@ -11,7 +11,7 @@ interface PreferenceListItem extends PreferenceItem {
}
const predefinedItems: PreferenceItem[] = [
- { label: 'General', icon: 'settings-filled' },
+ { label: 'General', icon: 'settings' },
{ label: 'Account', icon: 'user' },
{ label: 'Appearance', icon: 'themes' },
{ label: 'Security', icon: 'security' },
@@ -22,22 +22,23 @@ const predefinedItems: PreferenceItem[] = [
{ label: 'Help & feedback', icon: 'help' },
];
-export class MockState {
+export class Preferences {
private readonly _items: PreferenceListItem[];
private _selectedId = 0;
constructor(items: PreferenceItem[] = predefinedItems) {
- makeObservable
(this, {
+ makeObservable(this, {
_selectedId: observable,
+ selectedItem: computed,
items: computed,
- select: action,
+ selectItem: action,
});
this._items = items.map((p, idx) => ({ ...p, id: idx }));
this._selectedId = this._items[0].id;
}
- select(id: number) {
+ selectItem(id: number) {
this._selectedId = id;
}
@@ -47,4 +48,8 @@ export class MockState {
selected: p.id === this._selectedId,
}));
}
+
+ get selectedItem(): PreferenceListItem {
+ return this._items.find((item) => item.id === this._selectedId)!;
+ }
}
diff --git a/app/assets/javascripts/components/preferences/view.tsx b/app/assets/javascripts/components/preferences/view.tsx
index 01ceb8773d7..9b2f8b8541c 100644
--- a/app/assets/javascripts/components/preferences/view.tsx
+++ b/app/assets/javascripts/components/preferences/view.tsx
@@ -1,28 +1,45 @@
import { IconButton } from '@/components/IconButton';
import { TitleBar, Title } from '@/components/TitleBar';
import { FunctionComponent } from 'preact';
-import { PreferencesPane } from './pane';
+import { Preferences } from './preferences';
+import { PreferencesMenu } from './menu';
+import { HelpAndFeedback } from './help-feedback';
+import { observer } from 'mobx-react-lite';
interface PreferencesViewProps {
close: () => void;
}
-export const PreferencesView: FunctionComponent = ({
- close,
-}) => (
-
-
- {/* div is added so flex justify-between can center the title */}
-
- Your preferences for Standard Notes
- {
- close();
- }}
- type="normal"
- iconType="close"
- />
-
-
+export const PreferencesCanvas: FunctionComponent<{
+ preferences: Preferences;
+}> = observer(({ preferences: prefs }) => (
+
+
+ {/* Temporary selector until a full solution is implemented */}
+ {prefs.selectedItem.label === 'Help & feedback' ? (
+
+ ) : null}
-);
+));
+
+export const PreferencesView: FunctionComponent
=
+ observer(({ close }) => {
+ const prefs = new Preferences();
+ return (
+
+
+ {/* div is added so flex justify-between can center the title */}
+
+ Your preferences for Standard Notes
+ {
+ close();
+ }}
+ type="normal"
+ iconType="close"
+ />
+
+
+
+ );
+ });
diff --git a/app/assets/stylesheets/_preferences.scss b/app/assets/stylesheets/_preferences.scss
index d57b438e445..3d490e54c62 100644
--- a/app/assets/stylesheets/_preferences.scss
+++ b/app/assets/stylesheets/_preferences.scss
@@ -30,6 +30,7 @@
@extend .border-gray-300;
@extend .border-solid;
@extend .border-1;
+ @extend .bg-default;
}
}
diff --git a/package.json b/package.json
index 99259db296e..1e3e729880b 100644
--- a/package.json
+++ b/package.json
@@ -55,7 +55,7 @@
"pug-loader": "^2.4.0",
"sass-loader": "^8.0.2",
"serve-static": "^1.14.1",
- "sn-stylekit": "5.2.3",
+ "sn-stylekit": "5.2.5",
"ts-loader": "^8.0.17",
"typescript": "4.2.3",
"typescript-eslint": "0.0.1-alpha.0",
diff --git a/yarn.lock b/yarn.lock
index 2c5dc2918ef..ef35041ddb9 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7908,10 +7908,10 @@ slice-ansi@^4.0.0:
astral-regex "^2.0.0"
is-fullwidth-code-point "^3.0.0"
-sn-stylekit@5.2.3:
- version "5.2.3"
- resolved "https://registry.yarnpkg.com/sn-stylekit/-/sn-stylekit-5.2.3.tgz#24246471c03cde5129bda51a08fabef4d3c4880c"
- integrity sha512-hzziH89IY2UjmGh8OYgapb+/QVD6P6NNjnoyzSyveOh671MM9Z4IaPLZTJckgxJVjV0q7G495Pxfta5r4CSRDQ==
+sn-stylekit@5.2.5:
+ version "5.2.5"
+ resolved "https://registry.yarnpkg.com/sn-stylekit/-/sn-stylekit-5.2.5.tgz#85a28da395fedbaae9f7a91c48648042cdcc8052"
+ integrity sha512-8J+8UtRvukyJOBp79RcD4IZrvJJbjYY6EdN4N125K0xW84nDjgURuPuCjwm4lnp6vcXODU6r5d3JMDJoXYq8wA==
dependencies:
"@reach/listbox" "^0.15.0"
"@reach/menu-button" "^0.15.1"