sakura/src/admin/options.ts

133 lines
3.1 KiB
TypeScript
Raw Normal View History

2021-07-14 16:54:49 +08:00
export interface Options {
[tag: string]: {
title: string
2021-07-15 18:22:43 +08:00
desc?: string
2021-07-14 16:54:49 +08:00
icon: string
options: Array<{
namespace: string
2021-07-15 18:22:43 +08:00
title: string
desc?: string
2021-07-14 16:54:49 +08:00
type: string
default: any
2021-07-15 18:22:43 +08:00
binds?: { [key: string]: any }
2021-07-14 16:54:49 +08:00
}>
}
}
const options: Options = {
basic: {
title: 'Basic',
2021-07-15 18:22:43 +08:00
desc: 'The basic options',
2021-07-14 16:54:49 +08:00
icon: 'fas fa-address-card',
options: [
{
namespace: 'basic.siteTitle',
2021-07-15 18:22:43 +08:00
title: 'Site title',
desc: 'The site title',
2021-07-14 16:54:49 +08:00
type: 'string',
default: 'Opps',
},
{
2021-07-15 18:22:43 +08:00
namespace: 'basic.switcher',
title: 'Switcher',
type: 'switcher',
default: true,
binds: {
positiveLabel: 'current on',
negativeLabel: 'current off',
disabled: false,
},
},
{
namespace: 'basic.chooseTest',
title: 'Choose Test',
desc: 'wooooo',
type: 'choose',
default: NaN,
binds: {
options: [
{ label: 'op 1', disabled: false },
{ label: 'op 2', disabled: false },
{ label: 'op 3', disabled: false },
{ label: 'op 4', disabled: true },
],
max: 2,
},
},
{
namespace: 'basic.optionsTest',
title: 'Option Test',
desc: 'wooooo',
type: 'selection',
default: [true, false, true],
binds: {
options: [
{ label: 'op 1', disabled: false },
{ label: 'op 2', disabled: false },
{ label: 'op 3', disabled: false },
{ label: 'op 4', disabled: true },
],
max: 2,
},
},
{
namespace: 'basic.longString',
title: 'Long string',
desc: 'A long string',
type: 'longString',
default: 'Opps',
},
{
namespace: 'basic.mediaPicker',
title: 'Image picker',
desc: 'Media picker',
type: 'mediaPicker',
default: [
{
id: 0,
url: 'https://view.moezx.cc/images/2021/07/02/d5ab73174d18652d890e2f4d1b9bef8f.gif',
},
{
id: 0,
url: 'https://view.moezx.cc/images/2021/07/02/a90553bf5b67770e87a89b2ce204eaa7.gif',
},
],
binds: {
title: 'Select Media',
button: 'Use this media',
type: 'image',
multiple: true,
},
2021-07-14 16:54:49 +08:00
},
],
},
social: {
title: 'Social',
icon: 'fas fa-users',
options: [
2021-07-15 18:22:43 +08:00
{
namespace: 'social.github',
title: 'Github username',
desc: 'Your <a href="https://github.com" target="_blank">Github</a> username',
type: 'string',
default: 'mashirozx',
},
{ namespace: 'social.weibo', title: 'Weibo username', type: 'string', default: 'mashirozx' },
2021-07-14 16:54:49 +08:00
],
},
other: {
title: 'Other',
icon: 'fas fa-umbrella',
options: [
{
namespace: 'other.hello',
2021-07-15 18:22:43 +08:00
title: 'Hello world',
2021-07-14 16:54:49 +08:00
type: 'string',
default: 'world',
},
],
},
}
export default options