diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..b366c5d --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +## License +(The MIT License) + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/assets/global.scss b/assets/global.scss index 5f2fadd..b97f6d6 100644 --- a/assets/global.scss +++ b/assets/global.scss @@ -1,4 +1,5 @@ @import "variables"; +@import "node_modules/swiper/swiper.scss"; :root { --backgroundColor: #{$background-color}; @@ -26,3 +27,11 @@ .ant-spin-nested-loading > div > .ant-spin { max-height: unset; } + +.swiper-container { + height: 100vh; + + .swiper-wrapper { + position: fixed + } +} diff --git a/components/form/admin/design.tab.tsx b/components/form/admin/design.tab.tsx index 93ac569..e6e2d27 100644 --- a/components/form/admin/design.tab.tsx +++ b/components/form/admin/design.tab.tsx @@ -18,6 +18,7 @@ export const DesignTab: React.FC = props => { {name: 'questionColor', label: 'Question Color'}, {name: 'answerColor', label: 'Answer Color'}, {name: 'buttonColor', label: 'Button Color'}, + {name: 'buttonActiveColor', label: 'Button Active Color'}, {name: 'buttonTextColor', label: 'Button Text Color'}, ].map(({label, name}) => ( diff --git a/components/form/admin/end.page.tab.tsx b/components/form/admin/end.page.tab.tsx index 3e61806..8ba7aee 100644 --- a/components/form/admin/end.page.tab.tsx +++ b/components/form/admin/end.page.tab.tsx @@ -55,7 +55,14 @@ export const EndPageTab: React.FC = props => { remove(index)} /> ]} > - + @@ -67,6 +74,9 @@ export const EndPageTab: React.FC = props => { + + + diff --git a/components/form/admin/field.card.tsx b/components/form/admin/field.card.tsx index fb81039..e7a10b2 100644 --- a/components/form/admin/field.card.tsx +++ b/components/form/admin/field.card.tsx @@ -4,31 +4,8 @@ import {FormInstance} from 'antd/lib/form' import {FieldData} from 'rc-field-form/lib/interface' import React, {useEffect, useState} from 'react' import {AdminFormFieldFragment} from '../../../graphql/fragment/admin.form.fragment' -import {DateType} from './types/date.type' -import {DropdownType} from './types/dropdown.type' -import {EmailType} from './types/email.type' -import {HiddenType} from './types/hidden.type' -import {LinkType} from './types/link.type' -import {NumberType} from './types/number.type' -import {RadioType} from './types/radio.type' -import {RatingType} from './types/rating.type' +import {adminTypes} from './types' import {TextType} from './types/text.type' -import {TextareaType} from './types/textarea.type' -import {YesNoType} from './types/yes_no.type' - -export const availableTypes = { - 'textfield': TextType, - 'date': DateType, - 'email': EmailType, - 'textarea': TextareaType, - 'link': LinkType, - 'dropdown': DropdownType, - 'rating': RatingType, - 'radio': RadioType, - 'hidden': HiddenType, - 'yes_no': YesNoType, - 'number': NumberType, -} interface Props { form: FormInstance @@ -50,7 +27,7 @@ export const FieldCard: React.FC = props => { } = props const type = form.getFieldValue(['form', 'fields', field.name as string, 'type']) - const TypeComponent: React.FC = availableTypes[type] || TextType + const TypeComponent = adminTypes[type] || TextType const [nextTitle, setNextTitle] = useState(form.getFieldValue(['form', 'fields', field.name as string, 'title'])) @@ -120,6 +97,7 @@ export const FieldCard: React.FC = props => { name={[field.name as string, 'required']} labelCol={{ span: 6 }} valuePropName={'checked'} + extra={type === 'hidden' && 'If required, default value must be set to enable users to submit form!'} > diff --git a/components/form/admin/fields.tab.tsx b/components/form/admin/fields.tab.tsx index c218d35..d04670f 100644 --- a/components/form/admin/fields.tab.tsx +++ b/components/form/admin/fields.tab.tsx @@ -4,7 +4,8 @@ import {FormInstance} from 'antd/lib/form' import {TabPaneProps} from 'antd/lib/tabs' import React, {useCallback, useState} from 'react' import {AdminFormFieldFragment} from '../../../graphql/fragment/admin.form.fragment' -import {availableTypes, FieldCard} from './field.card' +import {FieldCard} from './field.card' +import {adminTypes} from './types' interface Props extends TabPaneProps { form: FormInstance @@ -40,7 +41,7 @@ export const FieldsTab: React.FC = props => { }} >