Skip to content

Commit

Permalink
[New #12] Set up Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Mar 16, 2022
1 parent e54c1f0 commit c9d8358
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 39 deletions.
36 changes: 29 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"jsonld": "^0.4.12",
"jsonld-utils": "https://kbss.felk.cvut.cz/dist/jsonld-utils-0.0.11.tgz",
"parcel": "2.0.0-beta.3.1",
"prettier": "2.6.0",
"prop-types": "^15.7.2",
"query-string": "^6.13.5",
"react": "^17.0.2",
Expand Down
82 changes: 50 additions & 32 deletions src/stories/ExampleApp.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import React, {useRef, useState} from 'react';
import SForms, {Constants} from 's-forms';
import React, { useRef, useState } from "react";
import SForms, { Constants } from "s-forms";
import SmartComponents from "../SmartComponents";
import exampleForm from './assets/example_form.json';
import exampleFormTC from './assets/example_turisticky_cil.json';
import possibleValues from './assets/possibleValues.json';
import {ComponentMeta, ComponentStory} from "@storybook/react";
import exampleForm from "./assets/example_form.json";
import exampleFormTC from "./assets/example_turisticky_cil.json";
import possibleValues from "./assets/possibleValues.json";
import { ComponentMeta, ComponentStory } from "@storybook/react";

const componentMapping = SmartComponents.getComponentMapping();

const modalProps = {
onHide: () => {
},
onHide: () => {},
show: true,
title: 'Title'
title: "Title",
};

const options = {
i18n: {
'wizard.next': 'Next',
'wizard.previous': 'Previous',
'section.expand': 'Expand',
'section.collapse': 'Collapse'
"wizard.next": "Next",
"wizard.previous": "Previous",
"section.expand": "Expand",
"section.collapse": "Collapse",
},
intl: {
locale: 'cs'
locale: "cs",
},
modalView: false,
modalProps,
Expand All @@ -32,19 +31,32 @@ const options = {
enableForwardSkip: true,
startingStep: 1,
users: [
{id: "http://fel.cvut.cz/people/max-chopart", label: "Max Chopart"},
{id: "http://fel.cvut.cz/people/miroslav-blasko", label: "Miroslav Blasko"}],
{ id: "http://fel.cvut.cz/people/max-chopart", label: "Max Chopart" },
{
id: "http://fel.cvut.cz/people/miroslav-blasko",
label: "Miroslav Blasko",
},
],
currentUser: "http://fel.cvut.cz/people/max-chopart",
icons: [
{id: Constants.ICONS.QUESTION_HELP, behavior: Constants.ICON_BEHAVIOR.ENABLE},
{id: Constants.ICONS.QUESTION_COMMENTS, behavior: Constants.ICON_BEHAVIOR.ON_HOVER},
{id: Constants.ICONS.QUESTION_LINK, behavior: Constants.ICON_BEHAVIOR.ON_HOVER},
]
{
id: Constants.ICONS.QUESTION_HELP,
behavior: Constants.ICON_BEHAVIOR.ENABLE,
},
{
id: Constants.ICONS.QUESTION_COMMENTS,
behavior: Constants.ICON_BEHAVIOR.ON_HOVER,
},
{
id: Constants.ICONS.QUESTION_LINK,
behavior: Constants.ICON_BEHAVIOR.ON_HOVER,
},
],
};

export default {
title: 'SForms Smart Component',
component: SForms
title: "SForms Smart Component",
component: SForms,
} as ComponentMeta<typeof SForms>;

const Template: ComponentStory<typeof SForms> = (args) => {
Expand All @@ -53,21 +65,27 @@ const Template: ComponentStory<typeof SForms> = (args) => {
const refForm = useRef();

const fetchTypeAheadValues = (query) => {
return new Promise((resolve) => setTimeout(() => resolve(possibleValues), 1500));
return new Promise((resolve) =>
setTimeout(() => resolve(possibleValues), 1500)
);
};


return (
<SForms options={options} componentMapping={componentMapping} form={selectedForm} {...args} />
);
}
return (
<SForms
options={options}
componentMapping={componentMapping}
form={selectedForm}
{...args}
/>
);
};

export const Default = Template.bind({});
Default.args = {
options: options
}
options: options,
};
export const AdvancedComponents = Template.bind({});
AdvancedComponents.args = {
options: options,
form: exampleFormTC
}
form: exampleFormTC,
};

0 comments on commit c9d8358

Please sign in to comment.