├── .babelrc
├── .eslintignore
├── .eslintrc.json
├── .github
└── workflows
│ └── package-build.yml
├── .gitignore
├── .npmignore
├── .prettierignore
├── .prettierrc
├── LICENSE
├── README.md
├── commitlint.config.js
├── docs
├── app-b08396ff4a1604499a77.js
├── app-b08396ff4a1604499a77.js.map
├── chunk-map.json
├── commons-b97e9a8e9fc46ec31d7a.js
├── commons-b97e9a8e9fc46ec31d7a.js.map
├── component---src-pages-demo-more-js-49fa05d97992b1e4c641.js
├── component---src-pages-demo-more-js-49fa05d97992b1e4c641.js.map
├── component---src-pages-index-js-25f547bcaeb4940cea12.js
├── component---src-pages-index-js-25f547bcaeb4940cea12.js.map
├── demo-more
│ └── index.html
├── framework-ac3690fb613cd7838c61.js
├── framework-ac3690fb613cd7838c61.js.map
├── index.html
├── page-data
│ ├── app-data.json
│ ├── demo-more
│ │ └── page-data.json
│ └── index
│ │ └── page-data.json
├── polyfill-1d7b72fd669edd5b5816.js
├── polyfill-1d7b72fd669edd5b5816.js.map
├── static
│ ├── c486398ea7e8be092969149052a88945
│ │ ├── 31987
│ │ │ └── ss_1.png
│ │ ├── 46604
│ │ │ └── ss_1.png
│ │ ├── 3dc0e
│ │ │ └── ss_1.png
│ │ └── e1953
│ │ │ └── ss_1.png
│ └── d
│ │ ├── 256249292.json
│ │ ├── 2916840477.json
│ │ └── 63159454.json
├── styles-2d82ac8e3afc0c213061.js
├── styles-2d82ac8e3afc0c213061.js.map
├── styles.bc0c6748db2aeca2522c.css
├── webpack-runtime-7a88f874c2dc04a855e4.js
├── webpack-runtime-7a88f874c2dc04a855e4.js.map
└── webpack.stats.json
├── example
├── .gitignore
├── closed.png
├── expanded.png
├── package-lock.json
├── package.json
├── public
│ ├── index.html
│ └── manifest.json
└── src
│ ├── App.js
│ ├── index.css
│ ├── index.js
│ ├── with-css-override
│ ├── index.css
│ └── index.js
│ └── with-style-parameter
│ └── index.js
├── package-lock.json
├── package.json
├── rollup.config.js
├── scripts
└── update_website.js
├── src
├── __mock__
│ ├── fileMock.js
│ └── styleMock.js
├── assets
│ └── arrow_down.svg
├── events.js
├── index.js
├── rowItem.js
├── styles.scss
└── test.js
└── website
├── .babelrc
├── .gitignore
├── .prettierignore
├── .prettierrc
├── LICENSE
├── README.md
├── gatsby-browser.js
├── gatsby-config.js
├── gatsby-node.js
├── gatsby-ssr.js
├── package-lock.json
├── package.json
└── src
├── components
├── faqToggleOption.js
├── footer.js
├── githubFork.js
├── header.js
├── image.js
├── index.css
├── layout.css
├── layout.js
└── seo.js
├── images
├── gatsby-astronaut.png
├── gatsby-icon.png
├── ss_1.png
├── ss_2.png
└── ss_3.png
└── pages
├── demo-more.js
└── index.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "@babel/preset-env",
4 | "@babel/preset-react"
5 | ],
6 | "plugins": [
7 | "@babel/plugin-proposal-object-rest-spread",
8 | "@babel/plugin-proposal-class-properties"
9 | // ,"transform-react-jsx"
10 | ]
11 | }
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules/*
2 | public/*
3 | example/*
4 | build/*
5 | dist/*
6 | website/*
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "babel-eslint",
3 | "env": {
4 | "browser": true,
5 | "node": true,
6 | "jest": true,
7 | "es6": true
8 | },
9 | "extends": ["eslint:recommended", "plugin:react/recommended"],
10 | "globals": {
11 | "Atomics": "readonly",
12 | "SharedArrayBuffer": "readonly"
13 | },
14 | "parserOptions": {
15 | "ecmaVersion": 6,
16 | "impliedStrict": true,
17 | "sourceType": "module",
18 | "ecmaFeatures": {
19 | "jsx": true
20 | }
21 | },
22 | "plugins": ["react"],
23 | "settings": {
24 | "react": {
25 | "version": "detect"
26 | }
27 | },
28 | "rules": {
29 | "comma-dangle": "off",
30 | "comma-spacing": [
31 | "error",
32 | {
33 | "after": true,
34 | "before": false
35 | }
36 | ],
37 | "comma-style": ["error", "last"],
38 | "semi": "error",
39 | "indent": [
40 | "error",
41 | 4,
42 | {
43 | "flatTernaryExpressions": true,
44 | "SwitchCase": 1
45 | }
46 | ],
47 | "jsx-quotes": ["error", "prefer-double"],
48 | "no-mixed-spaces-and-tabs": "error",
49 | "strict": "error",
50 | "max-len": ["error", 100],
51 | "prefer-const": "error",
52 | "no-console": "error",
53 | "no-const-assign": "error",
54 | "no-empty": [
55 | "error",
56 | {
57 | "allowEmptyCatch": true
58 | }
59 | ],
60 | "no-undef": "error",
61 | "no-unused-vars": "off",
62 | "no-var": "error",
63 | "no-extend-native": "error"
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/.github/workflows/package-build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on:
4 | push:
5 | branches: [master]
6 |
7 | # Run tests for any PRs.
8 | pull_request:
9 |
10 | jobs:
11 | build:
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v2
16 | - name: Use Node.js to build
17 | uses: actions/setup-node@v1
18 | with:
19 | node-version: 12
20 | - run: npm i
21 | - run: npm run lint:js
22 | - run: npm test
23 | - run: npm run build
24 | env:
25 | CI: true
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 | *.lcov
24 |
25 | # nyc test coverage
26 | .nyc_output
27 |
28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29 | .grunt
30 |
31 | # Bower dependency directory (https://bower.io/)
32 | bower_components
33 |
34 | # node-waf configuration
35 | .lock-wscript
36 |
37 | # Compiled binary addons (https://nodejs.org/api/addons.html)
38 | build/Release
39 |
40 | # Dependency directories
41 | node_modules/
42 | jspm_packages/
43 |
44 | # TypeScript v1 declaration files
45 | typings/
46 |
47 | # TypeScript cache
48 | *.tsbuildinfo
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Optional REPL history
57 | .node_repl_history
58 |
59 | # Output of 'npm pack'
60 | *.tgz
61 |
62 | # Yarn Integrity file
63 | .yarn-integrity
64 |
65 | # dotenv environment variables file
66 | .env
67 | .env.test
68 |
69 | # parcel-bundler cache (https://parceljs.org/)
70 | .cache
71 |
72 | # next.js build output
73 | .next
74 |
75 | # nuxt.js build output
76 | .nuxt
77 |
78 | # vuepress build output
79 | .vuepress/dist
80 |
81 | # Serverless directories
82 | .serverless/
83 |
84 | # FuseBox cache
85 | .fusebox/
86 |
87 | # DynamoDB Local files
88 | .dynamodb/
89 |
90 | build/
91 | example/build/
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | src
2 | example
3 | .babelrc
4 | webpack.config.js
5 | .gitignore
6 | README.md
7 | node_modules/
8 | coverage
9 | docs
10 | __mock__
11 | test.js
12 | website
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | .cache
2 | package-lock.json
3 | public
4 | build
5 | dist
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": false,
3 | "tabWidth": 4,
4 | "trailingComma": "all",
5 | "printWidth": 100
6 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Binod Kumar Swain
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-faq-component
2 |
3 | [](https://www.npmjs.com/package/react-faq-component)
4 | [](https://github.com/binodswain/react-faq-component/issues)
5 | [](https://github.com/binodswain/react-faq-component/blob/master/LICENSE)
6 | [](https://github.com/binodswain/react-faq-component/actions/workflows/package-build.yml)
7 |
8 | An accessible React package to render FAQ section.
9 | [view demo](https://binodswain.github.io/react-faq-component/)
10 |
11 | ## Install
12 |
13 | ```bash
14 | npm install --save react-faq-component
15 | ```
16 |
17 | ## Usage
18 |
19 | ```jsx
20 | import React, { useEffect, useState } from "react";
21 | import Faq from "react-faq-component";
22 |
23 | const data = {
24 | title: "FAQ (How it works)",
25 | rows: [
26 | {
27 | title: "Lorem ipsum dolor sit amet,",
28 | content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
29 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
30 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
31 | Fusce sed commodo purus, at tempus turpis.`,
32 | },
33 | {
34 | title: "Nunc maximus, magna at ultricies elementum",
35 | content:
36 | "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.",
37 | },
38 | {
39 | title: "Curabitur laoreet, mauris vel blandit fringilla",
40 | content: `Curabitur laoreet, mauris vel blandit fringilla, leo elit rhoncus nunc, ac sagittis leo elit vel lorem.
41 | Fusce tempor lacus ut libero posuere viverra. Nunc velit dolor, tincidunt at varius vel, laoreet vel quam.
42 | Sed dolor urna, lobortis in arcu auctor, tincidunt mattis ante. Vivamus venenatis ultricies nibh in volutpat.
43 | Cras eu metus quis leo vestibulum feugiat nec sagittis lacus.Mauris vulputate arcu sed massa euismod dignissim. `,
44 | },
45 | {
46 | title: "What is the package version",
47 | content:
current version is 1.2.1
,
48 | },
49 | ],
50 | };
51 |
52 | const styles = {
53 | // bgColor: 'white',
54 | titleTextColor: "blue",
55 | rowTitleColor: "blue",
56 | // rowContentColor: 'grey',
57 | // arrowColor: "red",
58 | };
59 |
60 | const config = {
61 | // animate: true,
62 | // arrowIcon: "V",
63 | // tabFocus: true
64 | };
65 |
66 | export default function App {
67 |
68 | return (
69 |
70 |
75 |
76 | );
77 | }
78 | ```
79 |
80 | ## `data` props
81 |
82 | The data passed to react-faq-component is an object having below keys(mentioned in the table).
83 |
84 | | attribute | type | optional | details |
85 | | --------- | :----: | :------: | :---------------------------------------------------- |
86 | | title | String | true | Text displayed as the title/header of the FAQ section |
87 | | rows | Array | true | Array of obj containing title and content of each row |
88 |
89 | ## `config` props (optional)
90 |
91 | ```js
92 | const config = {
93 | animate: true,
94 | arrowIcon: "V",
95 | openOnload: 0,
96 | expandIcon: "+",
97 | collapseIcon: "-",
98 | };
99 | ```
100 |
101 | The config passed to react-faq-component is an object having below keys(mentioned in the table).
102 |
103 | | attribute | type | optional | details |
104 | | ------------ | :--------: | :------: | :------------------------------------------------------------------------------------------------------------------------------------------- |
105 | | animate | Boolean | true | Whether to enable the (row) content animation (default val : true) |
106 | | arrowIcon | JSX/string | true | Custom component to display instead of default arrow |
107 | | tabFocus | Boolean | true | Whether to add outline on tab focus (default val : false). Focus outline is added when keyboard tab is used to navigate through the contents |
108 | | openOnload | Boolean | true | Index of the row to expand onload (0 for first row) |
109 | | expandIcon | string | true | Text to Show when row is collapsed (collapseIcon is required). |
110 | | collapseIcon | string | true | Text to Show when row is expanded |
111 |
112 | Note: `arrowIcon` is not displayed if `expandIcon` and `collapseIcon` is provided.
113 |
114 | ## `styles` props format
115 |
116 | `styles` attribute in data is optional and can be used to change text/bg color in FAQ component.
117 | e.g:
118 |
119 | ```js
120 | const data = {
121 | title: ...,
122 | rows: [...],
123 | styles: {
124 | // bgColor: 'white',
125 | titleTextColor: 'blue',
126 | // titleTextSize: '48px',
127 | rowTitleColor: 'blue',
128 | // rowTitleTextSize: 'medium',
129 | // rowContentColor: 'grey',
130 | rowContentTextSize: '16px',
131 | // rowContentPaddingTop: '10px',
132 | rowContentPaddingBottom: '10px',
133 | rowContentPaddingLeft: '50px',
134 | // rowContentPaddingRight: '150px',
135 | // arrowColor: "red",
136 | //transitionDuration: "1s",
137 | // timingFunc: "ease"
138 | }
139 | }
140 | ```
141 |
142 | | attribute | type | optional | default value | details |
143 | | ----------------------- | :----: | :------: | :-----------: | :------------------------------------------------- |
144 | | bgColor | String | true | white | background color of faq-component |
145 | | titleTextColor | String | true | black | text color of FAQ title/header text |
146 | | titleTextSize | String | true | 30px | size of FAQ title/header text |
147 | | rowTitleColor | String | true | black | text color of title text of rowItems |
148 | | rowTitleTextSize | String | true | large | size of title text in rowItems |
149 | | rowContentColor | String | true | black | text color of row content in rowItems |
150 | | rowContentTextSize | String | true | medium | size of row content in rowItems |
151 | | arrowColor | String | true | black | color of row arrow |
152 | | rowContentPaddingTop | String | true | 0 | value of padding-top of row content in rowItems |
153 | | rowContentPaddingBottom | String | true | 0 | value of padding-bottom of row content in rowItems |
154 | | rowContentPaddingLeft | String | true | 0 | value of padding-left of row content in rowItems |
155 | | rowContentPaddingRight | String | true | 0 | value of padding-right of row content in rowItems |
156 | | transitionDuration | String | true | 0.3s | transition duration for expanding row content |
157 | | timingFunc | String | true | ease | transition function for expanding row content |
158 |
159 | If the above style options are not enough, you can write you own custom css to apply styles on the elements.
160 |
161 | ```scss
162 | .faq-row-wrapper {
163 | .faq-title {
164 | }
165 |
166 | .faq-body {
167 | .faq-row {
168 | .row-title {
169 | }
170 |
171 | .row-content {
172 | .row-content-text {
173 | }
174 | }
175 | }
176 | }
177 | }
178 | ```
179 |
180 | [Example with css style](/example/src/with-css-override)
181 |
182 | These classnames are applied to the elements and do not contain any styles.
183 |
184 | ## `getRowOptions` props (optional)
185 |
186 | A function is passed as a value to getRowOptions prop, which gets called with an array parameter. The length of the array is the same as the number of rows present in FAQ data. 3 functions in an object are exported per row to toggle and scrollTntoView.
187 |
188 | ```js
189 | [
190 | // option for first row item
191 | {
192 | close: () => {},
193 | expand: () => {},
194 | scrollIntoView: (option) => {}, // option values : https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView#parameters
195 | },
196 | {...},
197 | {...},
198 | {...},
199 | ];
200 | ```
201 |
202 | **Example:**
203 |
204 | ```jsx
205 | export default function SampleFaqApp() {
206 | const [rows, setRowsOption] = useState(null);
207 |
208 | useEffect(() => {
209 | if (rows) {
210 | setTimeout(() => {
211 | rows[0].expand();
212 | }, 2500);
213 |
214 | setTimeout(() => {
215 | rows[0].close();
216 | }, 5000);
217 |
218 | setTimeout(() => {
219 | rows[0].scrollIntoView();
220 | // rows[0].scrollIntoView(true);
221 | }, 10000);
222 | }
223 | }, [rows]);
224 |
225 | return (
226 |
227 |
FAQ section
228 |
229 |
230 |
231 |
232 |
233 | );
234 | ```
235 |
236 | Note: On accessing invalid array index, an error will be logged in console.
237 |
238 | ## Screenshot
239 |
240 | 
241 |
242 | ---
243 |
244 | 
245 |
246 | ## License
247 |
248 | MIT © [binodswain](https://github.com/binodswain)
249 |
--------------------------------------------------------------------------------
/commitlint.config.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/commitlint.config.js
--------------------------------------------------------------------------------
/docs/chunk-map.json:
--------------------------------------------------------------------------------
1 | {
2 | "polyfill": ["/polyfill-1d7b72fd669edd5b5816.js"],
3 | "app": ["/app-b08396ff4a1604499a77.js"],
4 | "component---src-pages-demo-more-js": [
5 | "/component---src-pages-demo-more-js-49fa05d97992b1e4c641.js"
6 | ],
7 | "component---src-pages-index-js": ["/component---src-pages-index-js-25f547bcaeb4940cea12.js"]
8 | }
9 |
--------------------------------------------------------------------------------
/docs/component---src-pages-demo-more-js-49fa05d97992b1e4c641.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp = window.webpackJsonp || []).push([
2 | [5],
3 | {
4 | Agvw: function (e, t, n) {
5 |
6 | n.r(t);
7 | const a = n("q1tI"),
8 | i = n.n(a),
9 | o = n("Bl7J"),
10 | r = n("vrFN"),
11 | s = n("TwNY"),
12 | l = n("W/9C"),
13 | u = n("tHFp"),
14 | m = n("jHpe"),
15 | c = n.n(m),
16 | d =
17 | (n("y1X9"),
18 | n("QWvX"),
19 | n("ZgVT"),
20 | n("bPOv"),
21 | n("85O/"),
22 | n("CjHp"),
23 | n("hL/g"),
24 | {
25 | title: "FAQ (How it works)",
26 | rows: [
27 | {
28 | title:
29 | "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat",
30 | content:
31 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\n Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\n Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\n Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\n Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\n Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\n Fusce sed commodo purus, at tempus turpis.",
32 | },
33 | {
34 | title: "Nunc maximus, magna at ultricies elementum",
35 | content:
36 | "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.",
37 | },
38 | {
39 | title: "Can I use html as content",
40 | content:
41 | 'Yes, here is an example of a link ',
42 | },
43 | { title: "What is the package version", content: "v1.0.0" },
44 | ],
45 | });
46 | function p() {
47 | const e = Object(a.useState)(null),
48 | t = e[0],
49 | n = e[1],
50 | o = Object(a.useState)(0),
51 | r = o[0],
52 | s = o[1];
53 | return i.a.createElement(
54 | "div",
55 | { id: "external-toggle" },
56 | i.a.createElement(
57 | "div",
58 | { className: "row-option" },
59 | i.a.createElement("label", { htmlFor: "rownum" }, "Enter row number:"),
60 | i.a.createElement("input", {
61 | type: "number",
62 | id: "rownum",
63 | value: r,
64 | onChange: function (e) {
65 | return s(e.target.value);
66 | },
67 | min: "0",
68 | max: "3",
69 | disabled: !t,
70 | }),
71 | i.a.createElement(
72 | "button",
73 | {
74 | type: "button",
75 | onClick: function () {
76 | t && t[r].expand();
77 | },
78 | },
79 | "Exapnd row",
80 | ),
81 | i.a.createElement(
82 | "button",
83 | {
84 | type: "button",
85 | onClick: function () {
86 | t && t[r].close();
87 | },
88 | },
89 | "Close row",
90 | ),
91 | ),
92 | i.a.createElement(
93 | "div",
94 | null,
95 | i.a.createElement(u.a, { data: d, getRowOptions: n }),
96 | ),
97 | );
98 | }
99 | const g = {
100 | title: "FAQ (How it works)",
101 | rows: [
102 | {
103 | title:
104 | "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, ",
105 | content:
106 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\n Fusce sed commodo purus, at tempus turpis.",
107 | },
108 | {
109 | title: "Nunc maximus, magna at ultricies elementum",
110 | content:
111 | "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.",
112 | },
113 | {
114 | title: "Can I use html as content",
115 | content:
116 | 'Yes, here is an example of a link ',
117 | },
118 | { title: "What is the package version", content: "v1.0.5" },
119 | ],
120 | };
121 | t.default = function () {
122 | return (
123 | Object(a.useEffect)(function () {
124 | c.a.highlightAll();
125 | }, []),
126 | i.a.createElement(
127 | a.Fragment,
128 | null,
129 | i.a.createElement(
130 | o.a,
131 | null,
132 | i.a.createElement(r.a, { title: "More demos" }),
133 | i.a.createElement(s.a, null),
134 | i.a.createElement("h1", null, "More Demos"),
135 | i.a.createElement(
136 | "section",
137 | { className: "demo" },
138 | i.a.createElement("h2", null, "View 1 (with animation):"),
139 | i.a.createElement(
140 | "pre",
141 | null,
142 | i.a.createElement(
143 | "code",
144 | { className: "language-jsx" },
145 | ' ',
146 | ),
147 | ),
148 | i.a.createElement(u.a, {
149 | data: g,
150 | styles: {
151 | titleTextColor: "green",
152 | rowTitleColor: "mediumseagreen",
153 | },
154 | }),
155 | i.a.createElement(
156 | "h2",
157 | null,
158 | "View 2 (with animation, custom icon):",
159 | ),
160 | i.a.createElement(
161 | "pre",
162 | null,
163 | i.a.createElement(
164 | "code",
165 | { className: "language-jsx" },
166 | ' ',
167 | ),
168 | ),
169 | i.a.createElement(u.a, {
170 | data: g,
171 | styles: {
172 | titleTextColor: "green",
173 | rowTitleColor: "mediumseagreen",
174 | arrowColor: "red",
175 | },
176 | config: { arrowIcon: "V" },
177 | }),
178 | i.a.createElement(
179 | "h2",
180 | null,
181 | "View 3 (with different title colors):",
182 | ),
183 | i.a.createElement(
184 | "pre",
185 | null,
186 | i.a.createElement(
187 | "code",
188 | { className: "language-jsx" },
189 | ' ',
190 | ),
191 | ),
192 | i.a.createElement(u.a, {
193 | data: g,
194 | styles: {
195 | titleTextColor: "green",
196 | rowTitleColor: "mediumseagreen",
197 | rowContentColor: "grey",
198 | },
199 | }),
200 | i.a.createElement("h2", null, "View 4 (with content padding):"),
201 | i.a.createElement(
202 | "pre",
203 | null,
204 | i.a.createElement(
205 | "code",
206 | { className: "language-jsx" },
207 | " ",
208 | ),
209 | ),
210 | i.a.createElement(u.a, {
211 | data: g,
212 | styles: {
213 | bgColor: "white",
214 | titleTextColor: "#48482a",
215 | rowTitleColor: "#78789a",
216 | rowTitleTextSize: "large",
217 | rowContentColor: "#48484a",
218 | rowContentTextSize: "16px",
219 | rowContentPaddingTop: "10px",
220 | rowContentPaddingBottom: "10px",
221 | rowContentPaddingLeft: "50px",
222 | rowContentPaddingRight: "150px",
223 | arrowColor: "black",
224 | },
225 | }),
226 | i.a.createElement(
227 | "h2",
228 | null,
229 | "View 5 (with custom transition and tabFocus):",
230 | ),
231 | i.a.createElement(
232 | "pre",
233 | null,
234 | i.a.createElement(
235 | "code",
236 | { className: "language-jsx" },
237 | ' ',
238 | ),
239 | ),
240 | i.a.createElement(u.a, {
241 | data: g,
242 | styles: { transitionDuration: "2.5s", timingFunc: "linear" },
243 | config: { tabFocus: !0 },
244 | }),
245 | i.a.createElement("h2", null, "View 6 (with external row toggle):"),
246 | i.a.createElement(
247 | "pre",
248 | null,
249 | i.a.createElement(
250 | "code",
251 | { className: "language-jsx" },
252 | 'export default function App() {\n const [rows, setRowsOption] = useState(null)\n const [row, setRow] = useState(0)\n \n const expand = () => {\n rows && rows[row].expand()\n }\n \n const close = () => {\n rows && rows[row].close()\n }\n\n return (\n \n
\n\n
\n Enter row number: \n setRow(e.target.value)}\n min="0" max="3" disabled={!rows}\n />\n \n Exapnd row\n \n\n \n Close row\n \n
\n
\n );\n}\n\n ',
253 | ),
254 | ),
255 | i.a.createElement(p, null),
256 | ),
257 | ),
258 | i.a.createElement(l.a, null),
259 | )
260 | );
261 | };
262 | },
263 | },
264 | ]);
265 | //# sourceMappingURL=component---src-pages-demo-more-js-49fa05d97992b1e4c641.js.map
266 |
--------------------------------------------------------------------------------
/docs/component---src-pages-demo-more-js-49fa05d97992b1e4c641.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///./src/components/faqToggleOption.js","webpack:///./src/pages/demo-more.js"],"names":["data","title","rows","content","App","useState","setRowsOption","row","setRow","id","className","htmlFor","type","value","onChange","e","target","min","max","disabled","onClick","expand","close","getRowOptions","IndexPage","useEffect","Prism","highlightAll","styles","titleTextColor","rowTitleColor","arrowColor","config","arrowIcon","rowContentColor","bgColor","rowTitleTextSize","rowContentTextSize","rowContentPaddingTop","rowContentPaddingBottom","rowContentPaddingLeft","rowContentPaddingRight","transitionDuration","timingFunc","tabFocus"],"mappings":"4MAGMA,G,sEAAO,CACXC,MAAO,qBACPC,KAAM,CACJ,CACED,MACE,gVACFE,QAAQ,i4EAoBV,CACEF,MAAO,6CACPE,QACE,iHAEJ,CACEF,MAAO,4BACPE,QAAQ,qGAEV,CACEF,MAAO,8BACPE,QAAS,aAKA,SAASC,IAAO,IAAD,EACEC,mBAAS,MAAhCH,EADqB,KACfI,EADe,OAEND,mBAAS,GAAxBE,EAFqB,KAEhBC,EAFgB,KAY5B,OACE,yBAAKC,GAAG,mBACN,yBAAKC,UAAU,cACb,2BAAOC,QAAQ,UAAf,qBACA,2BACEC,KAAK,SACLH,GAAG,SACHI,MAAON,EACPO,SAAU,SAAAC,GAAC,OAAIP,EAAOO,EAAEC,OAAOH,QAC/BI,IAAI,IACJC,IAAI,IACJC,UAAWjB,IAEb,4BAAQU,KAAK,SAASQ,QArBb,WACblB,GAAQA,EAAKK,GAAKc,WAoBd,cAIA,4BAAQT,KAAK,SAASQ,QArBd,WACZlB,GAAQA,EAAKK,GAAKe,UAoBd,cAKF,6BACE,kBAAC,IAAD,CAAKtB,KAAMA,EAAMuB,cAAejB,MCtExC,IAAMN,EAAO,CACXC,MAAO,qBACPC,KAAM,CACJ,CACED,MACE,iKACFE,QAAQ,8ZAKV,CACEF,MAAO,6CACPE,QACE,8NAEJ,CACEF,MAAO,4BACPE,QAAQ,qGAEV,CACEF,MAAO,8BACPE,QAAS,YA+MAqB,UA1MG,WAMhB,OALAC,qBAAU,WAERC,IAAMC,iBACL,IAGD,kBAAC,WAAD,KAcE,kBAAC,IAAD,KACE,kBAAC,IAAD,CAAK1B,MAAM,eACX,kBAAC,IAAD,MACA,0CACA,6BAASS,UAAU,QACjB,wDACA,6BACE,0BAAMA,UAAU,gBAAhB,kIAUF,kBAAC,IAAD,CACEV,KAAMA,EACN4B,OAAQ,CACNC,eAAgB,QAChBC,cAAe,oBAInB,qEACA,6BACE,0BAAMpB,UAAU,gBAAhB,mLAaF,kBAAC,IAAD,CACEV,KAAMA,EACN4B,OAAQ,CACNC,eAAgB,QAChBC,cAAe,iBACfC,WAAY,OAEdC,OAAQ,CACNC,UAAW,OAIf,qEACA,6BACE,0BAAMvB,UAAU,gBAAhB,oKAWF,kBAAC,IAAD,CACEV,KAAMA,EACN4B,OAAQ,CACNC,eAAgB,QAChBC,cAAe,iBACfI,gBAAiB,UAIrB,8DACA,6BACE,0BAAMxB,UAAU,gBAAhB,udAmBF,kBAAC,IAAD,CACEV,KAAMA,EACN4B,OAAQ,CACNO,QAAS,QACTN,eAAgB,UAChBC,cAAe,UACfM,iBAAkB,QAClBF,gBAAiB,UACjBG,mBAAoB,OACpBC,qBAAsB,OACtBC,wBAAyB,OACzBC,sBAAuB,OACvBC,uBAAwB,QACxBV,WAAY,WAIhB,6EACA,6BACE,0BAAMrB,UAAU,gBAAhB,oKAUF,kBAAC,IAAD,CACEV,KAAMA,EACN4B,OAAQ,CACNc,mBAAoB,OACpBC,WAAY,UAEdX,OAAQ,CACNY,UAAU,KAId,kEACA,6BACE,0BAAMlC,UAAU,gBAAhB,y8BAoCF,kBAAC,EAAD,QAGJ,kBAAC,IAAD","file":"component---src-pages-demo-more-js-49fa05d97992b1e4c641.js","sourcesContent":["import React, { useEffect, useState } from \"react\"\r\nimport Faq from \"react-faq-component\"\r\n\r\nconst data = {\r\n title: \"FAQ (How it works)\",\r\n rows: [\r\n {\r\n title:\r\n \"Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat\",\r\n content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\r\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\r\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\r\n Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\r\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\r\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\r\n Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\r\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\r\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\r\n Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\r\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\r\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\r\n Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\r\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\r\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\r\n Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\r\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\r\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\r\n Fusce sed commodo purus, at tempus turpis.`,\r\n },\r\n {\r\n title: \"Nunc maximus, magna at ultricies elementum\",\r\n content:\r\n \"Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.\",\r\n },\r\n {\r\n title: \"Can I use html as content\",\r\n content: `Yes, here is an example of a link `,\r\n },\r\n {\r\n title: \"What is the package version\",\r\n content: \"v1.0.0\",\r\n },\r\n ],\r\n}\r\n\r\nexport default function App() {\r\n const [rows, setRowsOption] = useState(null)\r\n const [row, setRow] = useState(0)\r\n\r\n const expand = () => {\r\n rows && rows[row].expand()\r\n }\r\n\r\n const close = () => {\r\n rows && rows[row].close()\r\n }\r\n\r\n return (\r\n \r\n
\r\n Enter row number: \r\n setRow(e.target.value)}\r\n min=\"0\"\r\n max=\"3\"\r\n disabled={!rows}\r\n />\r\n \r\n Exapnd row\r\n \r\n\r\n \r\n Close row\r\n \r\n
\r\n\r\n
\r\n \r\n
\r\n
\r\n )\r\n}\r\n","import React, { useEffect } from \"react\"\r\nimport Layout from \"../components/layout\"\r\nimport SEO from \"../components/seo\"\r\nimport Gitfork from \"../components/githubFork\"\r\nimport Footer from \"../components/footer\"\r\nimport Faq from \"react-faq-component\"\r\nimport Prism from \"prismjs\"\r\nimport { Fragment } from \"react\"\r\nimport FaqExternal from \"../components/faqToggleOption\"\r\n\r\nconst data = {\r\n title: \"FAQ (How it works)\",\r\n rows: [\r\n {\r\n title:\r\n \"Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, \",\r\n content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\r\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\r\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\r\n Fusce sed commodo purus, at tempus turpis.`,\r\n },\r\n {\r\n title: \"Nunc maximus, magna at ultricies elementum\",\r\n content:\r\n \"Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.\",\r\n },\r\n {\r\n title: \"Can I use html as content\",\r\n content: `Yes, here is an example of a link `,\r\n },\r\n {\r\n title: \"What is the package version\",\r\n content: \"v1.0.5\",\r\n },\r\n ],\r\n}\r\n\r\nconst IndexPage = () => {\r\n useEffect(() => {\r\n // call the highlightAll() function to style our code blocks\r\n Prism.highlightAll()\r\n }, [])\r\n\r\n return (\r\n \r\n {/* */}\r\n\r\n \r\n \r\n \r\n More Demos \r\n \r\n View 1 (with animation): \r\n \r\n \r\n {` `}\r\n
\r\n \r\n \r\n\r\n View 2 (with animation, custom icon): \r\n \r\n \r\n {` `}\r\n
\r\n \r\n \r\n\r\n View 3 (with different title colors): \r\n \r\n \r\n {` `}\r\n
\r\n \r\n \r\n\r\n View 4 (with content padding): \r\n \r\n \r\n {` `}\r\n
\r\n \r\n \r\n\r\n View 5 (with custom transition and tabFocus): \r\n \r\n {` `}
\r\n \r\n \r\n\r\n View 6 (with external row toggle): \r\n \r\n {`export default function App() {\r\n const [rows, setRowsOption] = useState(null)\r\n const [row, setRow] = useState(0)\r\n \r\n const expand = () => {\r\n rows && rows[row].expand()\r\n }\r\n \r\n const close = () => {\r\n rows && rows[row].close()\r\n }\r\n\r\n return (\r\n \r\n
\r\n\r\n
\r\n Enter row number: \r\n setRow(e.target.value)}\r\n min=\"0\" max=\"3\" disabled={!rows}\r\n />\r\n \r\n Exapnd row\r\n \r\n\r\n \r\n Close row\r\n \r\n
\r\n
\r\n );\r\n}\r\n\r\n `}
\r\n \r\n \r\n \r\n \r\n \r\n \r\n )\r\n}\r\n\r\nexport default IndexPage\r\n"],"sourceRoot":""}
--------------------------------------------------------------------------------
/docs/component---src-pages-index-js-25f547bcaeb4940cea12.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp = window.webpackJsonp || []).push([
2 | [6],
3 | {
4 | PdVa: function (e) {
5 | e.exports = JSON.parse(
6 | '{"data":{"site":{"siteMetadata":{"title":"react-faq-component","description":"An accessible react package to render FAQ(frequently asked questions) in your React web app. Supports configurable parameters to customize as per requirement."}}}}',
7 | );
8 | },
9 | RXBc: function (e, t, a) {
10 |
11 | a.r(t);
12 | const n = a("q1tI"),
13 | r = a.n(n),
14 | l = (a("qePV"), a("+ZDr")),
15 | s = a.n(l);
16 | a("lw3w"), a("emEt").default.enqueue;
17 | const i = a("Bl7J"),
18 | o = a("vrFN"),
19 | c = a("TwNY"),
20 | m = a("tHFp"),
21 | u = a("jHpe"),
22 | p = a.n(u),
23 | f =
24 | (a("y1X9"),
25 | a("QWvX"),
26 | a("ZgVT"),
27 | a("bPOv"),
28 | a("85O/"),
29 | a("CjHp"),
30 | a("hL/g"),
31 | a("PdVa")),
32 | d = function () {
33 | const e = f.data;
34 | console.log(e);
35 | const t = e.site.siteMetadata,
36 | a = t.title,
37 | n = t.description;
38 | return r.a.createElement(
39 | "header",
40 | { className: "banner-sec" },
41 | r.a.createElement(
42 | "div",
43 | {
44 | style: {
45 | margin: "0 auto",
46 | maxWidth: 960,
47 | padding: "6.45rem 1.0875rem",
48 | marginBottom: "1em",
49 | },
50 | },
51 | r.a.createElement("h1", { style: { margin: 0 } }, a),
52 | r.a.createElement("p", { className: "banner-text" }, n),
53 | r.a.createElement("div", { className: "button-sec" }),
54 | ),
55 | );
56 | };
57 | d.defaultProps = { siteTitle: "" };
58 | const g = d,
59 | E = a("W/9C"),
60 | b = {
61 | title: "FAQ title",
62 | rows: [
63 | { title: "Question 1", content: "Answer 1" },
64 | { title: "Question 2", content: "Answer 2" },
65 | ],
66 | },
67 | h = {
68 | title: "FAQ (How it works)",
69 | rows: [
70 | {
71 | title: "Lorem ipsum dolor sit amet,",
72 | content:
73 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,\n ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.\n In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.\n Fusce sed commodo purus, at tempus turpis.",
74 | },
75 | {
76 | title: "Nunc maximus, magna at ultricies elementum",
77 | content:
78 | "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.",
79 | },
80 | {
81 | title: "Can I use html as content",
82 | content:
83 | 'Yes, here is an example of a link ',
84 | },
85 | { title: "What is the package version", content: "v1.0.5" },
86 | ],
87 | },
88 | v = { animate: !0 },
89 | N = { titleTextColor: "blue", rowTitleColor: "blue" };
90 | t.default = function () {
91 | return (
92 | Object(n.useEffect)(function () {
93 | p.a.highlightAll();
94 | }, []),
95 | r.a.createElement(
96 | n.Fragment,
97 | null,
98 | r.a.createElement(o.a, { title: "react-faq-component" }),
99 | r.a.createElement(g, null),
100 | r.a.createElement(
101 | i.a,
102 | null,
103 | r.a.createElement(c.a, null),
104 | r.a.createElement(
105 | "section",
106 | { className: "badges" },
107 | r.a.createElement(
108 | "a",
109 | { href: "https://www.npmjs.com/package/react-faq-component" },
110 | r.a.createElement("img", {
111 | src: "https://badgen.net/npm/v/react-faq-component",
112 | alt: "release",
113 | }),
114 | ),
115 | r.a.createElement(
116 | "a",
117 | {
118 | href:
119 | "https://github.com/binodswain/react-faq-component/issues",
120 | },
121 | r.a.createElement("img", {
122 | src:
123 | "https://badgen.net/github/open-issues/binodswain/react-faq-component",
124 | alt: "open-issues",
125 | }),
126 | ),
127 | r.a.createElement(
128 | "a",
129 | {
130 | href:
131 | "https://github.com/binodswain/react-faq-component/blob/master/LICENSE",
132 | },
133 | r.a.createElement("img", {
134 | src:
135 | "https://badgen.net/github/license/binodswain/react-faq-component",
136 | alt: "license",
137 | }),
138 | ),
139 | ),
140 | r.a.createElement(
141 | "section",
142 | { className: "demo" },
143 | r.a.createElement("h2", null, "Demo"),
144 | r.a.createElement(m.a, { data: h, styles: N, config: v }),
145 | r.a.createElement(s.a, { to: "/demo-more" }, "More demo"),
146 | ),
147 | r.a.createElement(
148 | "section",
149 | { className: "usage" },
150 | r.a.createElement("h3", null, "Usage"),
151 | r.a.createElement("div", null, "Install the package."),
152 | r.a.createElement(
153 | "pre",
154 | null,
155 | r.a.createElement(
156 | "code",
157 | { className: "language-markup" },
158 | "npm install --save react-faq-component",
159 | ),
160 | ),
161 | r.a.createElement("div", null, "Import the package."),
162 | r.a.createElement(
163 | "pre",
164 | null,
165 | r.a.createElement(
166 | "code",
167 | { className: "language-jsx" },
168 | "import Faq from 'react-faq-component';",
169 | ),
170 | ),
171 | r.a.createElement("br", null),
172 | r.a.createElement("div", null, "example: "),
173 | r.a.createElement("br", null),
174 | r.a.createElement(
175 | "pre",
176 | { className: "line-numbers" },
177 | r.a.createElement(
178 | "code",
179 | { className: "language-jsx" },
180 | 'import React, { Component } from \'react\';\nimport Faq from \'react-faq-component\';\n\nconst data = {\n title: "FAQ (How it works)",\n rows: [\n {\n title: "Lorem ipsum dolor sit amet,",\n content: "Lorem ipsum dolor sit amet, consectetur "\n },\n {\n title: "Nunc maximus, magna at ultricies elementum",\n content: "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam."\n },\n {\n title: "Curabitur laoreet, mauris vel blandit fringilla",\n content: "Curabitur laoreet, mauris vel blandit fringilla, leo elit rhoncus nunc"\n },\n {\n title: "What is the package version",\n content: "v1.0.5"\n }]\n}\n\nexport default class App extends Component {\n render() {\n return (\n \n \n
\n )\n }\n}\n',
181 | ),
182 | ),
183 | ),
184 | r.a.createElement(
185 | "section",
186 | { className: "dataformat" },
187 | r.a.createElement("h3", null, "Data format"),
188 | r.a.createElement(
189 | "p",
190 | null,
191 | "The data passed into ",
192 | r.a.createElement("strong", null, "react-faq-component"),
193 | " is an object having two keys i.e ",
194 | r.a.createElement("strong", null, "title"),
195 | " (String) and",
196 | " ",
197 | r.a.createElement("strong", null, "rows"),
198 | " (array of objects).",
199 | ),
200 | r.a.createElement(
201 | "pre",
202 | { className: "line-numbers" },
203 | r.a.createElement(
204 | "code",
205 | { className: "language-json" },
206 | JSON.stringify(b, null, 4),
207 | ),
208 | ),
209 | ),
210 | ),
211 | r.a.createElement(E.a, null),
212 | )
213 | );
214 | };
215 | },
216 | WJkJ: function (e, t) {
217 | e.exports = "\t\n\v\f\r \u2028\u2029\ufeff";
218 | },
219 | WKiH: function (e, t, a) {
220 | const n = a("HYAF"),
221 | r = "[" + a("WJkJ") + "]",
222 | l = RegExp("^" + r + r + "*"),
223 | s = RegExp(r + r + "*$"),
224 | i = function (e) {
225 | return function (t) {
226 | let a = String(n(t));
227 | return 1 & e && (a = a.replace(l, "")), 2 & e && (a = a.replace(s, "")), a;
228 | };
229 | };
230 | e.exports = { start: i(1), end: i(2), trim: i(3) };
231 | },
232 | lw3w: function (e, t, a) {
233 | let n;
234 | e.exports = ((n = a("rzlk")) && n.default) || n;
235 | },
236 | qePV: function (e, t, a) {
237 |
238 | const n = a("g6v/"),
239 | r = a("2oRo"),
240 | l = a("lMq5"),
241 | s = a("busE"),
242 | i = a("UTVS"),
243 | o = a("xrYK"),
244 | c = a("cVYH"),
245 | m = a("wE6v"),
246 | u = a("0Dky"),
247 | p = a("fHMY"),
248 | f = a("JBy8").f,
249 | d = a("Bs8V").f,
250 | g = a("m/L8").f,
251 | E = a("WKiH").trim,
252 | b = r.Number,
253 | h = b.prototype,
254 | v = "Number" == o(p(h)),
255 | N = function (e) {
256 | let t,
257 | a,
258 | n,
259 | r,
260 | l,
261 | s,
262 | i,
263 | o,
264 | c = m(e, !1);
265 | if ("string" == typeof c && c.length > 2)
266 | if (43 === (t = (c = E(c)).charCodeAt(0)) || 45 === t) {
267 | if (88 === (a = c.charCodeAt(2)) || 120 === a) return NaN;
268 | } else if (48 === t) {
269 | switch (c.charCodeAt(1)) {
270 | case 66:
271 | case 98:
272 | (n = 2), (r = 49);
273 | break;
274 | case 79:
275 | case 111:
276 | (n = 8), (r = 55);
277 | break;
278 | default:
279 | return +c;
280 | }
281 | for (s = (l = c.slice(2)).length, i = 0; i < s; i++)
282 | if ((o = l.charCodeAt(i)) < 48 || o > r) return NaN;
283 | return parseInt(l, n);
284 | }
285 | return +c;
286 | };
287 | if (l("Number", !b(" 0o1") || !b("0b1") || b("+0x1"))) {
288 | for (
289 | var w,
290 | q = function (e) {
291 | const t = arguments.length < 1 ? 0 : e,
292 | a = this;
293 | return a instanceof q &&
294 | (v
295 | ? u(function () {
296 | h.valueOf.call(a);
297 | })
298 | : "Number" != o(a))
299 | ? c(new b(N(t)), a, q)
300 | : N(t);
301 | },
302 | I = n
303 | ? f(b)
304 | : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(
305 | ",",
306 | ),
307 | x = 0;
308 | I.length > x;
309 | x++
310 | )
311 | i(b, (w = I[x])) && !i(q, w) && g(q, w, d(b, w));
312 | (q.prototype = h), (h.constructor = q), s(r, "Number", q);
313 | }
314 | },
315 | rzlk: function (e, t, a) {
316 |
317 | a.r(t);
318 | a("zKZe");
319 | const n = a("q1tI"),
320 | r = a.n(n),
321 | l = a("IOVJ");
322 | t.default = function (e) {
323 | const t = e.location,
324 | a = e.pageResources;
325 | return a
326 | ? r.a.createElement(
327 | l.a,
328 | Object.assign({ location: t, pageResources: a }, a.json),
329 | )
330 | : null;
331 | };
332 | },
333 | },
334 | ]);
335 | //# sourceMappingURL=component---src-pages-index-js-25f547bcaeb4940cea12.js.map
336 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 | react-faq-component Demo Lorem ipsum dolor sit amet,
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
2 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
3 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
4 | Fusce sed commodo purus, at tempus turpis.
Nunc maximus, magna at ultricies elementum
Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.
Can I use html as content
Yes, here is an example of a
link What is the package version
More demo Usage Install the package.
npm install --save react-faq-component
Import the package.
import Faq from 'react-faq-component';
example:
import React, { Component } from 'react';
5 | import Faq from 'react-faq-component';
6 |
7 | const data = {
8 | title: "FAQ (How it works)",
9 | rows: [
10 | {
11 | title: "Lorem ipsum dolor sit amet,",
12 | content: "Lorem ipsum dolor sit amet, consectetur "
13 | },
14 | {
15 | title: "Nunc maximus, magna at ultricies elementum",
16 | content: "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam."
17 | },
18 | {
19 | title: "Curabitur laoreet, mauris vel blandit fringilla",
20 | content: "Curabitur laoreet, mauris vel blandit fringilla, leo elit rhoncus nunc"
21 | },
22 | {
23 | title: "What is the package version",
24 | content: "v1.0.5"
25 | }]
26 | }
27 |
28 | export default class App extends Component {
29 | render() {
30 | return (
31 | <div>
32 | <Faq data={data}/>
33 | </div>
34 | )
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/docs/page-data/app-data.json:
--------------------------------------------------------------------------------
1 | { "webpackCompilationHash": "616a0b01db712834b00b" }
2 |
--------------------------------------------------------------------------------
/docs/page-data/demo-more/page-data.json:
--------------------------------------------------------------------------------
1 | {"componentChunkName":"component---src-pages-demo-more-js","path":"/demo-more/","result":{"pageContext":{}}}
--------------------------------------------------------------------------------
/docs/page-data/index/page-data.json:
--------------------------------------------------------------------------------
1 | {"componentChunkName":"component---src-pages-index-js","path":"/","result":{"pageContext":{}}}
--------------------------------------------------------------------------------
/docs/static/c486398ea7e8be092969149052a88945/31987/ss_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/docs/static/c486398ea7e8be092969149052a88945/31987/ss_1.png
--------------------------------------------------------------------------------
/docs/static/c486398ea7e8be092969149052a88945/3dc0e/ss_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/docs/static/c486398ea7e8be092969149052a88945/3dc0e/ss_1.png
--------------------------------------------------------------------------------
/docs/static/c486398ea7e8be092969149052a88945/46604/ss_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/docs/static/c486398ea7e8be092969149052a88945/46604/ss_1.png
--------------------------------------------------------------------------------
/docs/static/c486398ea7e8be092969149052a88945/e1953/ss_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/docs/static/c486398ea7e8be092969149052a88945/e1953/ss_1.png
--------------------------------------------------------------------------------
/docs/static/d/256249292.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "site": {
4 | "siteMetadata": {
5 | "title": "react-faq-component",
6 | "description": "An accessible react package to render FAQ(frequently asked questions) in your React web app. Supports configurable parameters to customize as per requirement."
7 | }
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/docs/static/d/2916840477.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "placeholderImage": {
4 | "childImageSharp": {
5 | "fluid": {
6 | "base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsSAAALEgHS3X78AAAAnElEQVQoz6WR0Q6DIAxF+f9f9GEuM3sVFQVH27uLZsa9DUdy0qSBk1vqVAXLMiOleGCGy8fFGNE0N7Rthzt5dE8KlVgVqvsbx8qEO/MM5IxNWC78ykcoInAiRpFSyBoM02QYBkMI9QkLm9B7ge8FPYmLoPQKtcIj4TiuTJUojghjqv6/r4Q5K0WZo4JiYH2VXf0h3Bu6SQC9tOEzb0s5d9QV/JblAAAAAElFTkSuQmCC",
7 | "aspectRatio": 2.6595744680851063,
8 | "src": "/react-faq-component/static/c486398ea7e8be092969149052a88945/31987/ss_1.png",
9 | "srcSet": "/react-faq-component/static/c486398ea7e8be092969149052a88945/e1953/ss_1.png 250w,\n/react-faq-component/static/c486398ea7e8be092969149052a88945/46604/ss_1.png 500w,\n/react-faq-component/static/c486398ea7e8be092969149052a88945/31987/ss_1.png 1000w,\n/react-faq-component/static/c486398ea7e8be092969149052a88945/3dc0e/ss_1.png 1105w",
10 | "sizes": "(max-width: 1000px) 100vw, 1000px"
11 | }
12 | }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/docs/static/d/63159454.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": {
3 | "site": {
4 | "siteMetadata": {
5 | "title": "react-faq-component",
6 | "description": "An accessible react package to render FAQ(frequently asked questions) in your React web app. Supports configurable parameters to customize as per requirement.",
7 | "author": "@swain_binod"
8 | }
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/docs/styles-2d82ac8e3afc0c213061.js:
--------------------------------------------------------------------------------
1 | (window.webpackJsonp = window.webpackJsonp || []).push([[2], []]);
2 | //# sourceMappingURL=styles-2d82ac8e3afc0c213061.js.map
3 |
--------------------------------------------------------------------------------
/docs/styles-2d82ac8e3afc0c213061.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":[],"names":[],"mappings":"","file":"styles-2d82ac8e3afc0c213061.js","sourceRoot":""}
--------------------------------------------------------------------------------
/docs/styles.bc0c6748db2aeca2522c.css:
--------------------------------------------------------------------------------
1 | html{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}[hidden],template{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:inherit;font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:700}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}html{font:112.5%/1.45em georgia,serif;box-sizing:border-box;overflow-y:scroll}*,:after,:before{box-sizing:inherit}body{color:rgba(0,0,0,.8);font-weight:400;word-wrap:break-word;-webkit-font-kerning:normal;font-kerning:normal;-ms-font-feature-settings:"kern","liga","clig","calt";font-feature-settings:"kern","liga","clig","calt"}img{max-width:100%;padding:0;margin:0 0 1.45rem}h1{font-size:2.25rem}h1,h2{padding:0;margin:0 0 1.45rem;color:inherit;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-weight:700;text-rendering:optimizeLegibility;line-height:1.1}h2{font-size:1.62671rem}h3{font-size:1.38316rem}h3,h4{padding:0;margin:0 0 1.45rem;color:inherit;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-weight:700;text-rendering:optimizeLegibility;line-height:1.1}h4{font-size:1rem}h5{font-size:.85028rem}h5,h6{padding:0;margin:0 0 1.45rem;color:inherit;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-weight:700;text-rendering:optimizeLegibility;line-height:1.1}h6{font-size:.78405rem}hgroup{padding:0;margin:0 0 1.45rem}ol,ul{padding:0;margin:0 0 1.45rem 1.45rem;list-style-position:outside;list-style-image:none}dd,dl,figure,p{padding:0;margin:0 0 1.45rem}pre{margin:0 0 1.45rem;font-size:.85rem;line-height:1.42;background:rgba(0,0,0,.04);border-radius:3px;overflow:auto;word-wrap:normal;padding:1.45rem}table{font-size:1rem;line-height:1.45rem;border-collapse:collapse;width:100%}fieldset,table{padding:0;margin:0 0 1.45rem}blockquote{padding:0;margin:0 1.45rem 1.45rem}form,iframe,noscript{padding:0;margin:0 0 1.45rem}hr{padding:0;margin:0 0 calc(1.45rem - 1px);background:rgba(0,0,0,.2);border:none;height:1px}address{padding:0;margin:0 0 1.45rem}b,dt,strong,th{font-weight:700}li{margin-bottom:.725rem}ol li,ul li{padding-left:0}li>ol,li>ul{margin-left:1.45rem;margin-bottom:.725rem;margin-top:.725rem}blockquote :last-child,li :last-child,p :last-child{margin-bottom:0}li>p{margin-bottom:.725rem}code,kbd,samp{font-size:.85rem;line-height:1.45rem}abbr,abbr[title],acronym{border-bottom:1px dotted rgba(0,0,0,.5);cursor:help}abbr[title]{text-decoration:none}td,th,thead{text-align:left}td,th{border-bottom:1px solid rgba(0,0,0,.12);font-feature-settings:"tnum";-moz-font-feature-settings:"tnum";-ms-font-feature-settings:"tnum";-webkit-font-feature-settings:"tnum";padding:.725rem .96667rem calc(.725rem - 1px)}td:first-child,th:first-child{padding-left:0}td:last-child,th:last-child{padding-right:0}code,tt{background-color:rgba(0,0,0,.04);border-radius:3px;font-family:SFMono-Regular,Consolas,Roboto Mono,Droid Sans Mono,Liberation Mono,Menlo,Courier,monospace;padding:.2em 0}pre code{background:none;line-height:1.42}code:after,code:before,tt:after,tt:before{letter-spacing:-.2em;content:" "}pre code:after,pre code:before,pre tt:after,pre tt:before{content:""}@media only screen and (max-width:480px){html{font-size:100%}}:root{--fork-color:#5000ca}.dark-theme,:root{--bg-color:#000;--text-color:#fff}.dark-theme,.light-theme,:root{--banner-bg-color:#000;--banner-text-color:#fff}.light-theme{--bg-color:#fff;--text-color:#000}.banner-sec{background-color:var(--banner-bg-color);color:var(--banner-text-color);margin-bottom:1.5em}.banner-sec .banner-text{margin:2em 0 0}.footer-sec{background-color:var(--banner-bg-color);color:var(--banner-text-color);padding:1em 0}.footer-sec a{color:#fff}.row-option{margin:2em 0}.row-option label{font-weight:700;display:block;margin-bottom:.5em}.row-option input{padding:.5em;font-size:1em;border-radius:4px;border:1px solid #ccc}.row-option button{padding:.5em 1em;margin-left:1em;font-size:1em;border-radius:4px;background-color:#5000ca;border:1px solid;color:#fff}.badges a{padding-right:5px}.github-corner:hover .octo-arm{animation:octocat-wave .56s ease-in-out}@keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave .56s ease-in-out}}.github-corner svg{fill:var(--fork-color)}section{padding-bottom:20px}code[class*=language-],pre[class*=language-]{color:#ccc;background:none;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}
--------------------------------------------------------------------------------
/docs/webpack-runtime-7a88f874c2dc04a855e4.js:
--------------------------------------------------------------------------------
1 | !(function (e) {
2 | function t(t) {
3 | for (var n, o, u = t[0], i = t[1], s = t[2], l = 0, d = []; l < u.length; l++)
4 | (o = u[l]),
5 | Object.prototype.hasOwnProperty.call(a, o) && a[o] && d.push(a[o][0]),
6 | (a[o] = 0);
7 | for (n in i) Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n]);
8 | for (f && f(t); d.length; ) d.shift()();
9 | return c.push.apply(c, s || []), r();
10 | }
11 | function r() {
12 | for (var e, t = 0; t < c.length; t++) {
13 | for (var r = c[t], n = !0, o = 1; o < r.length; o++) {
14 | const i = r[o];
15 | 0 !== a[i] && (n = !1);
16 | }
17 | n && (c.splice(t--, 1), (e = u((u.s = r[0]))));
18 | }
19 | return e;
20 | }
21 | var n = {},
22 | o = { 3: 0 },
23 | a = { 3: 0 },
24 | c = [];
25 | function u(t) {
26 | if (n[t]) return n[t].exports;
27 | const r = (n[t] = { i: t, l: !1, exports: {} });
28 | return e[t].call(r.exports, r, r.exports, u), (r.l = !0), r.exports;
29 | }
30 | (u.e = function (e) {
31 | const t = [];
32 | o[e]
33 | ? t.push(o[e])
34 | : 0 !== o[e] &&
35 | { 2: 1 }[e] &&
36 | t.push(
37 | (o[e] = new Promise(function (t, r) {
38 | for (
39 | var n =
40 | ({
41 | 1: "framework",
42 | 2: "styles",
43 | 5: "component---src-pages-demo-more-js",
44 | 6: "component---src-pages-index-js",
45 | }[e] || e) +
46 | "." +
47 | {
48 | 1: "31d6cfe0d16ae931b73c",
49 | 2: "bc0c6748db2aeca2522c",
50 | 5: "31d6cfe0d16ae931b73c",
51 | 6: "31d6cfe0d16ae931b73c",
52 | }[e] +
53 | ".css",
54 | a = u.p + n,
55 | c = document.getElementsByTagName("link"),
56 | i = 0;
57 | i < c.length;
58 | i++
59 | ) {
60 | var s = (f = c[i]).getAttribute("data-href") || f.getAttribute("href");
61 | if ("stylesheet" === f.rel && (s === n || s === a)) return t();
62 | }
63 | const l = document.getElementsByTagName("style");
64 | for (i = 0; i < l.length; i++) {
65 | var f;
66 | if ((s = (f = l[i]).getAttribute("data-href")) === n || s === a)
67 | return t();
68 | }
69 | const d = document.createElement("link");
70 | (d.rel = "stylesheet"),
71 | (d.type = "text/css"),
72 | (d.onload = t),
73 | (d.onerror = function (t) {
74 | const n = (t && t.target && t.target.src) || a,
75 | c = new Error("Loading CSS chunk " + e + " failed.\n(" + n + ")");
76 | (c.code = "CSS_CHUNK_LOAD_FAILED"),
77 | (c.request = n),
78 | delete o[e],
79 | d.parentNode.removeChild(d),
80 | r(c);
81 | }),
82 | (d.href = a),
83 | document.getElementsByTagName("head")[0].appendChild(d);
84 | }).then(function () {
85 | o[e] = 0;
86 | })),
87 | );
88 | let r = a[e];
89 | if (0 !== r)
90 | if (r) t.push(r[2]);
91 | else {
92 | const n = new Promise(function (t, n) {
93 | r = a[e] = [t, n];
94 | });
95 | t.push((r[2] = n));
96 | let c,
97 | i = document.createElement("script");
98 | (i.charset = "utf-8"),
99 | (i.timeout = 120),
100 | u.nc && i.setAttribute("nonce", u.nc),
101 | (i.src = (function (e) {
102 | return (
103 | u.p +
104 | "" +
105 | ({
106 | 1: "framework",
107 | 2: "styles",
108 | 5: "component---src-pages-demo-more-js",
109 | 6: "component---src-pages-index-js",
110 | }[e] || e) +
111 | "-" +
112 | {
113 | 1: "ac3690fb613cd7838c61",
114 | 2: "2d82ac8e3afc0c213061",
115 | 5: "49fa05d97992b1e4c641",
116 | 6: "25f547bcaeb4940cea12",
117 | }[e] +
118 | ".js"
119 | );
120 | })(e));
121 | const s = new Error();
122 | c = function (t) {
123 | (i.onerror = i.onload = null), clearTimeout(l);
124 | const r = a[e];
125 | if (0 !== r) {
126 | if (r) {
127 | const n = t && ("load" === t.type ? "missing" : t.type),
128 | o = t && t.target && t.target.src;
129 | (s.message = "Loading chunk " + e + " failed.\n(" + n + ": " + o + ")"),
130 | (s.name = "ChunkLoadError"),
131 | (s.type = n),
132 | (s.request = o),
133 | r[1](s);
134 | }
135 | a[e] = void 0;
136 | }
137 | };
138 | var l = setTimeout(function () {
139 | c({ type: "timeout", target: i });
140 | }, 12e4);
141 | (i.onerror = i.onload = c), document.head.appendChild(i);
142 | }
143 | return Promise.all(t);
144 | }),
145 | (u.m = e),
146 | (u.c = n),
147 | (u.d = function (e, t, r) {
148 | u.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: r });
149 | }),
150 | (u.r = function (e) {
151 | "undefined" != typeof Symbol &&
152 | Symbol.toStringTag &&
153 | Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }),
154 | Object.defineProperty(e, "__esModule", { value: !0 });
155 | }),
156 | (u.t = function (e, t) {
157 | if ((1 & t && (e = u(e)), 8 & t)) return e;
158 | if (4 & t && "object" == typeof e && e && e.__esModule) return e;
159 | const r = Object.create(null);
160 | if (
161 | (u.r(r),
162 | Object.defineProperty(r, "default", { enumerable: !0, value: e }),
163 | 2 & t && "string" != typeof e)
164 | )
165 | for (const n in e)
166 | u.d(
167 | r,
168 | n,
169 | function (t) {
170 | return e[t];
171 | }.bind(null, n),
172 | );
173 | return r;
174 | }),
175 | (u.n = function (e) {
176 | const t =
177 | e && e.__esModule
178 | ? function () {
179 | return e.default;
180 | }
181 | : function () {
182 | return e;
183 | };
184 | return u.d(t, "a", t), t;
185 | }),
186 | (u.o = function (e, t) {
187 | return Object.prototype.hasOwnProperty.call(e, t);
188 | }),
189 | (u.p = "/react-faq-component/"),
190 | (u.oe = function (e) {
191 | throw (console.error(e), e);
192 | });
193 | let i = (window.webpackJsonp = window.webpackJsonp || []),
194 | s = i.push.bind(i);
195 | (i.push = t), (i = i.slice());
196 | for (let l = 0; l < i.length; l++) t(i[l]);
197 | var f = s;
198 | r();
199 | })([]);
200 | //# sourceMappingURL=webpack-runtime-7a88f874c2dc04a855e4.js.map
201 |
--------------------------------------------------------------------------------
/docs/webpack-runtime-7a88f874c2dc04a855e4.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","installedCssChunks","3","exports","module","l","e","promises","Promise","resolve","reject","href","fullhref","p","existingLinkTags","document","getElementsByTagName","dataHref","tag","getAttribute","rel","existingStyleTags","linkTag","createElement","type","onload","onerror","event","request","target","src","err","Error","code","parentNode","removeChild","appendChild","then","installedChunkData","promise","onScriptComplete","script","charset","timeout","nc","setAttribute","jsonpScriptSrc","error","clearTimeout","chunk","errorType","realSrc","message","name","undefined","setTimeout","head","all","m","c","d","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","oe","console","jsonpArray","window","oldJsonpFunction","slice"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDc,EAAQd,GAAYG,EAAYH,IAKlC,IAFGe,GAAqBA,EAAoBhB,GAEtCO,EAASC,QACdD,EAASU,OAATV,GAOD,OAHAW,EAAgBJ,KAAKK,MAAMD,EAAiBb,GAAkB,IAGvDe,IAER,SAASA,IAER,IADA,IAAIC,EACIf,EAAI,EAAGA,EAAIY,EAAgBV,OAAQF,IAAK,CAG/C,IAFA,IAAIgB,EAAiBJ,EAAgBZ,GACjCiB,GAAY,EACRC,EAAI,EAAGA,EAAIF,EAAed,OAAQgB,IAAK,CAC9C,IAAIC,EAAQH,EAAeE,GACG,IAA3BX,EAAgBY,KAAcF,GAAY,GAE3CA,IACFL,EAAgBQ,OAAOpB,IAAK,GAC5Be,EAASM,EAAoBA,EAAoBC,EAAIN,EAAe,KAItE,OAAOD,EAIR,IAAIQ,EAAmB,GAGnBC,EAAqB,CACxBC,EAAG,GAMAlB,EAAkB,CACrBkB,EAAG,GAGAb,EAAkB,GAQtB,SAASS,EAAoB1B,GAG5B,GAAG4B,EAAiB5B,GACnB,OAAO4B,EAAiB5B,GAAU+B,QAGnC,IAAIC,EAASJ,EAAiB5B,GAAY,CACzCK,EAAGL,EACHiC,GAAG,EACHF,QAAS,IAUV,OANAjB,EAAQd,GAAUW,KAAKqB,EAAOD,QAASC,EAAQA,EAAOD,QAASL,GAG/DM,EAAOC,GAAI,EAGJD,EAAOD,QAKfL,EAAoBQ,EAAI,SAAuBjC,GAC9C,IAAIkC,EAAW,GAKZN,EAAmB5B,GAAUkC,EAAStB,KAAKgB,EAAmB5B,IACzB,IAAhC4B,EAAmB5B,IAFX,CAAC,EAAI,GAEkCA,IACtDkC,EAAStB,KAAKgB,EAAmB5B,GAAW,IAAImC,SAAQ,SAASC,EAASC,GAIzE,IAHA,IAAIC,GAAa,CAAC,EAAI,YAAY,EAAI,SAAS,EAAI,qCAAqC,EAAI,kCAAkCtC,IAAUA,GAAW,IAAM,CAAC,EAAI,uBAAuB,EAAI,uBAAuB,EAAI,uBAAuB,EAAI,wBAAwBA,GAAW,OAC9QuC,EAAWd,EAAoBe,EAAIF,EACnCG,EAAmBC,SAASC,qBAAqB,QAC7CvC,EAAI,EAAGA,EAAIqC,EAAiBnC,OAAQF,IAAK,CAChD,IACIwC,GADAC,EAAMJ,EAAiBrC,IACR0C,aAAa,cAAgBD,EAAIC,aAAa,QACjE,GAAe,eAAZD,EAAIE,MAAyBH,IAAaN,GAAQM,IAAaL,GAAW,OAAOH,IAErF,IAAIY,EAAoBN,SAASC,qBAAqB,SACtD,IAAQvC,EAAI,EAAGA,EAAI4C,EAAkB1C,OAAQF,IAAK,CACjD,IAAIyC,EAEJ,IADID,GADAC,EAAMG,EAAkB5C,IACT0C,aAAa,gBAChBR,GAAQM,IAAaL,EAAU,OAAOH,IAEvD,IAAIa,EAAUP,SAASQ,cAAc,QACrCD,EAAQF,IAAM,aACdE,EAAQE,KAAO,WACfF,EAAQG,OAAShB,EACjBa,EAAQI,QAAU,SAASC,GAC1B,IAAIC,EAAUD,GAASA,EAAME,QAAUF,EAAME,OAAOC,KAAOlB,EACvDmB,EAAM,IAAIC,MAAM,qBAAuB3D,EAAU,cAAgBuD,EAAU,KAC/EG,EAAIE,KAAO,wBACXF,EAAIH,QAAUA,SACP3B,EAAmB5B,GAC1BiD,EAAQY,WAAWC,YAAYb,GAC/BZ,EAAOqB,IAERT,EAAQX,KAAOC,EAEJG,SAASC,qBAAqB,QAAQ,GAC5CoB,YAAYd,MACfe,MAAK,WACPpC,EAAmB5B,GAAW,MAMhC,IAAIiE,EAAqBtD,EAAgBX,GACzC,GAA0B,IAAvBiE,EAGF,GAAGA,EACF/B,EAAStB,KAAKqD,EAAmB,QAC3B,CAEN,IAAIC,EAAU,IAAI/B,SAAQ,SAASC,EAASC,GAC3C4B,EAAqBtD,EAAgBX,GAAW,CAACoC,EAASC,MAE3DH,EAAStB,KAAKqD,EAAmB,GAAKC,GAGtC,IACIC,EADAC,EAAS1B,SAASQ,cAAc,UAGpCkB,EAAOC,QAAU,QACjBD,EAAOE,QAAU,IACb7C,EAAoB8C,IACvBH,EAAOI,aAAa,QAAS/C,EAAoB8C,IAElDH,EAAOX,IAnGV,SAAwBzD,GACvB,OAAOyB,EAAoBe,EAAI,IAAM,CAAC,EAAI,YAAY,EAAI,SAAS,EAAI,qCAAqC,EAAI,kCAAkCxC,IAAUA,GAAW,IAAM,CAAC,EAAI,uBAAuB,EAAI,uBAAuB,EAAI,uBAAuB,EAAI,wBAAwBA,GAAW,MAkGvRyE,CAAezE,GAG5B,IAAI0E,EAAQ,IAAIf,MAChBQ,EAAmB,SAAUb,GAE5Bc,EAAOf,QAAUe,EAAOhB,OAAS,KACjCuB,aAAaL,GACb,IAAIM,EAAQjE,EAAgBX,GAC5B,GAAa,IAAV4E,EAAa,CACf,GAAGA,EAAO,CACT,IAAIC,EAAYvB,IAAyB,SAAfA,EAAMH,KAAkB,UAAYG,EAAMH,MAChE2B,EAAUxB,GAASA,EAAME,QAAUF,EAAME,OAAOC,IACpDiB,EAAMK,QAAU,iBAAmB/E,EAAU,cAAgB6E,EAAY,KAAOC,EAAU,IAC1FJ,EAAMM,KAAO,iBACbN,EAAMvB,KAAO0B,EACbH,EAAMnB,QAAUuB,EAChBF,EAAM,GAAGF,GAEV/D,EAAgBX,QAAWiF,IAG7B,IAAIX,EAAUY,YAAW,WACxBf,EAAiB,CAAEhB,KAAM,UAAWK,OAAQY,MAC1C,MACHA,EAAOf,QAAUe,EAAOhB,OAASe,EACjCzB,SAASyC,KAAKpB,YAAYK,GAG5B,OAAOjC,QAAQiD,IAAIlD,IAIpBT,EAAoB4D,EAAIxE,EAGxBY,EAAoB6D,EAAI3D,EAGxBF,EAAoB8D,EAAI,SAASzD,EAASkD,EAAMQ,GAC3C/D,EAAoBgE,EAAE3D,EAASkD,IAClCzE,OAAOmF,eAAe5D,EAASkD,EAAM,CAAEW,YAAY,EAAMC,IAAKJ,KAKhE/D,EAAoBoE,EAAI,SAAS/D,GACX,oBAAXgE,QAA0BA,OAAOC,aAC1CxF,OAAOmF,eAAe5D,EAASgE,OAAOC,YAAa,CAAEC,MAAO,WAE7DzF,OAAOmF,eAAe5D,EAAS,aAAc,CAAEkE,OAAO,KAQvDvE,EAAoBwE,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQvE,EAAoBuE,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAK7F,OAAO8F,OAAO,MAGvB,GAFA5E,EAAoBoE,EAAEO,GACtB7F,OAAOmF,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOvE,EAAoB8D,EAAEa,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIR3E,EAAoB+E,EAAI,SAASzE,GAChC,IAAIyD,EAASzD,GAAUA,EAAOoE,WAC7B,WAAwB,OAAOpE,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAN,EAAoB8D,EAAEC,EAAQ,IAAKA,GAC5BA,GAIR/D,EAAoBgE,EAAI,SAASgB,EAAQC,GAAY,OAAOnG,OAAOC,UAAUC,eAAeC,KAAK+F,EAAQC,IAGzGjF,EAAoBe,EAAI,wBAGxBf,EAAoBkF,GAAK,SAASjD,GAA2B,MAApBkD,QAAQlC,MAAMhB,GAAYA,GAEnE,IAAImD,EAAaC,OAAqB,aAAIA,OAAqB,cAAK,GAChEC,EAAmBF,EAAWjG,KAAK2F,KAAKM,GAC5CA,EAAWjG,KAAOf,EAClBgH,EAAaA,EAAWG,QACxB,IAAI,IAAI5G,EAAI,EAAGA,EAAIyG,EAAWvG,OAAQF,IAAKP,EAAqBgH,EAAWzG,IAC3E,IAAIU,EAAsBiG,EAI1B7F,I","file":"webpack-runtime-7a88f874c2dc04a855e4.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded CSS chunks\n \tvar installedCssChunks = {\n \t\t3: 0\n \t}\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t3: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// script path function\n \tfunction jsonpScriptSrc(chunkId) {\n \t\treturn __webpack_require__.p + \"\" + ({\"1\":\"framework\",\"2\":\"styles\",\"5\":\"component---src-pages-demo-more-js\",\"6\":\"component---src-pages-index-js\"}[chunkId]||chunkId) + \"-\" + {\"1\":\"ac3690fb613cd7838c61\",\"2\":\"2d82ac8e3afc0c213061\",\"5\":\"49fa05d97992b1e4c641\",\"6\":\"25f547bcaeb4940cea12\"}[chunkId] + \".js\"\n \t}\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tvar promises = [];\n\n\n \t\t// mini-css-extract-plugin CSS loading\n \t\tvar cssChunks = {\"2\":1};\n \t\tif(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);\n \t\telse if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {\n \t\t\tpromises.push(installedCssChunks[chunkId] = new Promise(function(resolve, reject) {\n \t\t\t\tvar href = \"\" + ({\"1\":\"framework\",\"2\":\"styles\",\"5\":\"component---src-pages-demo-more-js\",\"6\":\"component---src-pages-index-js\"}[chunkId]||chunkId) + \".\" + {\"1\":\"31d6cfe0d16ae931b73c\",\"2\":\"bc0c6748db2aeca2522c\",\"5\":\"31d6cfe0d16ae931b73c\",\"6\":\"31d6cfe0d16ae931b73c\"}[chunkId] + \".css\";\n \t\t\t\tvar fullhref = __webpack_require__.p + href;\n \t\t\t\tvar existingLinkTags = document.getElementsByTagName(\"link\");\n \t\t\t\tfor(var i = 0; i < existingLinkTags.length; i++) {\n \t\t\t\t\tvar tag = existingLinkTags[i];\n \t\t\t\t\tvar dataHref = tag.getAttribute(\"data-href\") || tag.getAttribute(\"href\");\n \t\t\t\t\tif(tag.rel === \"stylesheet\" && (dataHref === href || dataHref === fullhref)) return resolve();\n \t\t\t\t}\n \t\t\t\tvar existingStyleTags = document.getElementsByTagName(\"style\");\n \t\t\t\tfor(var i = 0; i < existingStyleTags.length; i++) {\n \t\t\t\t\tvar tag = existingStyleTags[i];\n \t\t\t\t\tvar dataHref = tag.getAttribute(\"data-href\");\n \t\t\t\t\tif(dataHref === href || dataHref === fullhref) return resolve();\n \t\t\t\t}\n \t\t\t\tvar linkTag = document.createElement(\"link\");\n \t\t\t\tlinkTag.rel = \"stylesheet\";\n \t\t\t\tlinkTag.type = \"text/css\";\n \t\t\t\tlinkTag.onload = resolve;\n \t\t\t\tlinkTag.onerror = function(event) {\n \t\t\t\t\tvar request = event && event.target && event.target.src || fullhref;\n \t\t\t\t\tvar err = new Error(\"Loading CSS chunk \" + chunkId + \" failed.\\n(\" + request + \")\");\n \t\t\t\t\terr.code = \"CSS_CHUNK_LOAD_FAILED\";\n \t\t\t\t\terr.request = request;\n \t\t\t\t\tdelete installedCssChunks[chunkId]\n \t\t\t\t\tlinkTag.parentNode.removeChild(linkTag)\n \t\t\t\t\treject(err);\n \t\t\t\t};\n \t\t\t\tlinkTag.href = fullhref;\n\n \t\t\t\tvar head = document.getElementsByTagName(\"head\")[0];\n \t\t\t\thead.appendChild(linkTag);\n \t\t\t}).then(function() {\n \t\t\t\tinstalledCssChunks[chunkId] = 0;\n \t\t\t}));\n \t\t}\n\n \t\t// JSONP chunk loading for javascript\n\n \t\tvar installedChunkData = installedChunks[chunkId];\n \t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n \t\t\t// a Promise means \"currently loading\".\n \t\t\tif(installedChunkData) {\n \t\t\t\tpromises.push(installedChunkData[2]);\n \t\t\t} else {\n \t\t\t\t// setup Promise in chunk cache\n \t\t\t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\t\t\tinstalledChunkData = installedChunks[chunkId] = [resolve, reject];\n \t\t\t\t});\n \t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n \t\t\t\t// start chunk loading\n \t\t\t\tvar script = document.createElement('script');\n \t\t\t\tvar onScriptComplete;\n\n \t\t\t\tscript.charset = 'utf-8';\n \t\t\t\tscript.timeout = 120;\n \t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t}\n \t\t\t\tscript.src = jsonpScriptSrc(chunkId);\n\n \t\t\t\t// create error before stack unwound to get useful stacktrace later\n \t\t\t\tvar error = new Error();\n \t\t\t\tonScriptComplete = function (event) {\n \t\t\t\t\t// avoid mem leaks in IE.\n \t\t\t\t\tscript.onerror = script.onload = null;\n \t\t\t\t\tclearTimeout(timeout);\n \t\t\t\t\tvar chunk = installedChunks[chunkId];\n \t\t\t\t\tif(chunk !== 0) {\n \t\t\t\t\t\tif(chunk) {\n \t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n \t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n \t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n \t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n \t\t\t\t\t\t\terror.type = errorType;\n \t\t\t\t\t\t\terror.request = realSrc;\n \t\t\t\t\t\t\tchunk[1](error);\n \t\t\t\t\t\t}\n \t\t\t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t\t\t}\n \t\t\t\t};\n \t\t\t\tvar timeout = setTimeout(function(){\n \t\t\t\t\tonScriptComplete({ type: 'timeout', target: script });\n \t\t\t\t}, 120000);\n \t\t\t\tscript.onerror = script.onload = onScriptComplete;\n \t\t\t\tdocument.head.appendChild(script);\n \t\t\t}\n \t\t}\n \t\treturn Promise.all(promises);\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/react-faq-component/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""}
--------------------------------------------------------------------------------
/docs/webpack.stats.json:
--------------------------------------------------------------------------------
1 | {
2 | "errors": [],
3 | "warnings": [],
4 | "namedChunkGroups": {
5 | "polyfill": {
6 | "chunks": [3, 0, 7],
7 | "assets": [
8 | "webpack-runtime-7a88f874c2dc04a855e4.js",
9 | "webpack-runtime-7a88f874c2dc04a855e4.js.map",
10 | "commons-b97e9a8e9fc46ec31d7a.js",
11 | "commons-b97e9a8e9fc46ec31d7a.js.map",
12 | "polyfill-1d7b72fd669edd5b5816.js",
13 | "polyfill-1d7b72fd669edd5b5816.js.map"
14 | ],
15 | "children": {},
16 | "childAssets": {}
17 | },
18 | "app": {
19 | "chunks": [3, 1, 0, 4],
20 | "assets": [
21 | "webpack-runtime-7a88f874c2dc04a855e4.js",
22 | "webpack-runtime-7a88f874c2dc04a855e4.js.map",
23 | "framework-ac3690fb613cd7838c61.js",
24 | "framework-ac3690fb613cd7838c61.js.map",
25 | "commons-b97e9a8e9fc46ec31d7a.js",
26 | "commons-b97e9a8e9fc46ec31d7a.js.map",
27 | "app-b08396ff4a1604499a77.js",
28 | "app-b08396ff4a1604499a77.js.map"
29 | ],
30 | "children": {},
31 | "childAssets": {}
32 | },
33 | "component---src-pages-demo-more-js": {
34 | "chunks": [1, 2, 0, 5],
35 | "assets": [
36 | "framework-ac3690fb613cd7838c61.js",
37 | "framework-ac3690fb613cd7838c61.js.map",
38 | "styles.bc0c6748db2aeca2522c.css",
39 | "styles-2d82ac8e3afc0c213061.js",
40 | "styles-2d82ac8e3afc0c213061.js.map",
41 | "commons-b97e9a8e9fc46ec31d7a.js",
42 | "commons-b97e9a8e9fc46ec31d7a.js.map",
43 | "component---src-pages-demo-more-js-49fa05d97992b1e4c641.js",
44 | "component---src-pages-demo-more-js-49fa05d97992b1e4c641.js.map"
45 | ],
46 | "children": {},
47 | "childAssets": {}
48 | },
49 | "component---src-pages-index-js": {
50 | "chunks": [1, 2, 0, 6],
51 | "assets": [
52 | "framework-ac3690fb613cd7838c61.js",
53 | "framework-ac3690fb613cd7838c61.js.map",
54 | "styles.bc0c6748db2aeca2522c.css",
55 | "styles-2d82ac8e3afc0c213061.js",
56 | "styles-2d82ac8e3afc0c213061.js.map",
57 | "commons-b97e9a8e9fc46ec31d7a.js",
58 | "commons-b97e9a8e9fc46ec31d7a.js.map",
59 | "component---src-pages-index-js-25f547bcaeb4940cea12.js",
60 | "component---src-pages-index-js-25f547bcaeb4940cea12.js.map"
61 | ],
62 | "children": {},
63 | "childAssets": {}
64 | }
65 | },
66 | "assetsByChunkName": {
67 | "polyfill": [
68 | "webpack-runtime-7a88f874c2dc04a855e4.js",
69 | "commons-b97e9a8e9fc46ec31d7a.js",
70 | "polyfill-1d7b72fd669edd5b5816.js"
71 | ],
72 | "app": [
73 | "webpack-runtime-7a88f874c2dc04a855e4.js",
74 | "framework-ac3690fb613cd7838c61.js",
75 | "commons-b97e9a8e9fc46ec31d7a.js",
76 | "app-b08396ff4a1604499a77.js"
77 | ],
78 | "component---src-pages-demo-more-js": [
79 | "framework-ac3690fb613cd7838c61.js",
80 | "styles.bc0c6748db2aeca2522c.css",
81 | "styles-2d82ac8e3afc0c213061.js",
82 | "commons-b97e9a8e9fc46ec31d7a.js",
83 | "component---src-pages-demo-more-js-49fa05d97992b1e4c641.js"
84 | ],
85 | "component---src-pages-index-js": [
86 | "framework-ac3690fb613cd7838c61.js",
87 | "styles.bc0c6748db2aeca2522c.css",
88 | "styles-2d82ac8e3afc0c213061.js",
89 | "commons-b97e9a8e9fc46ec31d7a.js",
90 | "component---src-pages-index-js-25f547bcaeb4940cea12.js"
91 | ]
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/example/closed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/example/closed.png
--------------------------------------------------------------------------------
/example/expanded.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/example/expanded.png
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-faq-component-example",
3 | "homepage": "https://binodswain.github.io/react-faq-component",
4 | "version": "0.0.0",
5 | "license": "MIT",
6 | "private": true,
7 | "dependencies": {
8 | "prop-types": "^15.6.2",
9 | "react": "^16.13.1",
10 | "react-dom": "^16.13.1",
11 | "react-faq-component": "file:..",
12 | "react-router-dom": "^5.2.0",
13 | "react-scripts": "^1.1.4"
14 | },
15 | "scripts": {
16 | "start": "react-scripts start",
17 | "build": "react-scripts build",
18 | "test": "react-scripts test --env=jsdom",
19 | "eject": "react-scripts eject"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/example/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | react-faq-component
11 |
12 |
13 |
14 |
15 | You need to enable JavaScript to run this app.
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/example/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "react-faq-component",
3 | "name": "react-faq-component",
4 | "start_url": "./index.html",
5 | "display": "standalone",
6 | "theme_color": "#000000",
7 | "background_color": "#ffffff"
8 | }
9 |
--------------------------------------------------------------------------------
/example/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component, Fragment } from "react";
2 | import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
3 | import WithStyleObjComp from "./with-style-parameter";
4 | import WithCssStyleComp from "./with-css-override";
5 |
6 | export default class App extends Component {
7 | render() {
8 | return (
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | );
25 | }
26 | }
27 |
28 | function About() {
29 | return About ;
30 | }
31 |
--------------------------------------------------------------------------------
/example/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 3em auto;
3 | padding: 0;
4 | font-family: sans-serif;
5 | max-width: 965px;
6 | padding: 0 2em;
7 | }
8 |
9 | .section-title {
10 | background-color: #5000ca;
11 | color: white;
12 | padding: 1em;
13 | margin: 2em 0;
14 | text-align: center;
15 | }
16 |
--------------------------------------------------------------------------------
/example/src/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 |
4 | import "./index.css";
5 | import App from "./App";
6 |
7 | ReactDOM.render( , document.getElementById("root"));
8 |
--------------------------------------------------------------------------------
/example/src/with-css-override/index.css:
--------------------------------------------------------------------------------
1 | .faq-style-wrapper {
2 | margin-top: 2em;
3 | }
4 |
5 | .faq-style-wrapper .faq-title {
6 | font-size: x-large;
7 | }
8 |
9 | .faq-style-wrapper .faq-body .faq-row {
10 | padding: 0.75em 0;
11 | }
12 |
13 | .faq-style-wrapper .faq-body .faq-row .row-title {
14 | font-size: larger;
15 | color: grey;
16 | }
17 |
18 | .faq-style-wrapper .faq-body .faq-row .row-content-text {
19 | padding: 2em !important;
20 | font-size: medium !important;
21 | color: teal !important;
22 | }
23 |
24 | .row-option {
25 | margin-top: 2em;
26 | }
27 |
28 | .row-option label {
29 | font-weight: bold;
30 | display: block;
31 | margin-bottom: 0.5em;
32 | }
33 |
34 | .row-option input {
35 | padding: 0.5em;
36 | width: 2em;
37 | font-size: 1em;
38 | border-radius: 4px;
39 | border: 1px solid #ccc;
40 | }
41 |
42 | .row-option button {
43 | padding: 0.5em 1em;
44 | margin-left: 1em;
45 | font-size: 1em;
46 | border-radius: 4px;
47 | background-color: #5000ca;
48 | border: 1px solid;
49 | color: white;
50 | }
51 |
--------------------------------------------------------------------------------
/example/src/with-css-override/index.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from "react";
2 | import Faq from "react-faq-component";
3 | import { Link } from "react-router-dom";
4 | import "./index.css";
5 |
6 | const data = {
7 | title: "FAQ (How it works)",
8 | rows: [
9 | {
10 | title:
11 | "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat",
12 | content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
13 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
14 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
15 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
16 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
17 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
18 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
19 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
20 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
21 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
22 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
23 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
24 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
25 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
26 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
27 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
28 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
29 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
30 | Fusce sed commodo purus, at tempus turpis.`,
31 | },
32 | {
33 | title: "Nunc maximus, magna at ultricies elementum",
34 | content:
35 | "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.",
36 | },
37 | {
38 | title: "Can I use html as content",
39 | content: `Yes, here is an example of a link `,
40 | },
41 | {
42 | title: "What is the package version",
43 | content: "v1.0.0",
44 | },
45 | ],
46 | };
47 |
48 | export default function WithCssStyleComp() {
49 | const [rows, setRowsOption] = useState(null);
50 | const [row, setRow] = useState(0);
51 |
52 | return (
53 |
54 |
Component with CSS style override
55 |
56 |
57 |
58 |
59 |
60 |
61 | Enter row number:
62 | setRow(e.target.value)} min="0" max="3" disabled={!rows}/>
63 | {
64 | rows && rows[row].expand()
65 | }}>
66 | Exapnd row
67 |
68 |
69 | {
70 | rows && rows[row].close()
71 | }}>
72 | Close row
73 |
74 |
75 |
76 | );
77 | }
78 |
--------------------------------------------------------------------------------
/example/src/with-style-parameter/index.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import Faq from "react-faq-component";
3 | import { Link } from "react-router-dom";
4 |
5 | const data = {
6 | title: "FAQ (How it works)",
7 | rows: [
8 | {
9 | title:
10 | "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat",
11 | content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
12 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
13 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
14 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
15 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
16 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
17 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
18 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
19 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
20 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
21 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
22 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
23 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
24 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
25 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
26 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
27 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
28 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
29 | Fusce sed commodo purus, at tempus turpis.`,
30 | },
31 | {
32 | title: "Nunc maximus, magna at ultricies elementum",
33 | content:
34 | "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.",
35 | },
36 | {
37 | title: "Can I use html as content",
38 | content: `Yes, here is an example of a link `,
39 | },
40 | {
41 | title: "What is the package version",
42 | content: "v1.0.0",
43 | },
44 | {
45 | title: "How about to other page (react-router-dom)",
46 | content: (
47 |
48 |
49 |
50 | Home
51 |
52 |
53 | About
54 |
55 |
56 |
57 | ),
58 | },
59 | ],
60 | };
61 |
62 | const styles = {
63 | // bgColor: 'white',
64 | titleTextColor: "blue",
65 | rowTitleColor: "blue",
66 | // rowContentColor: 'grey',
67 | timingFunc: "linear",
68 | };
69 |
70 | const config = {
71 | animate: true,
72 | arrowIcon: "V",
73 | tabFocus: true,
74 | };
75 |
76 | export default class WithStyleComp extends Component {
77 | render() {
78 | return (
79 |
80 |
Component with style parameter
81 |
82 |
83 |
101 |
102 |
103 |
104 |
112 |
113 |
114 |
115 |
123 |
124 |
125 |
126 |
135 |
136 |
137 |
138 |
139 |
147 |
148 |
149 |
150 |
151 |
152 |
160 |
161 |
162 | );
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-faq-component",
3 | "version": "1.3.4",
4 | "main": "build/index.js",
5 | "module": "build/index.es.js",
6 | "description": "React package to render collapsible faq sections",
7 | "scripts": {
8 | "test": "jest --verbose ./src",
9 | "lint:js": "eslint src/*.js",
10 | "lint": "eslint src/*.js",
11 | "prebuild": "npm-run-all lint:js clean",
12 | "build": "cross-env NODE_ENV=production rollup -c",
13 | "start": "rollup -c -w",
14 | "clean": "rimraf build dist",
15 | "format": "prettier --write \"**/*.{js,jsx,json,md}\"",
16 | "website": "node ./scripts/update_website.js",
17 | "prerelease": "npm run build",
18 | "release": "standard-version"
19 | },
20 | "files": [
21 | "build",
22 | "LICENCE",
23 | "package.json",
24 | "README.md"
25 | ],
26 | "repository": {
27 | "type": "git",
28 | "url": "git+https://github.com/binodswain/react-faq-component.git"
29 | },
30 | "jest": {
31 | "moduleNameMapper": {
32 | "\\.(css|less|sass|scss)$": "identity-obj-proxy",
33 | ".+\\.(svg|png|jpg|ttf|woff|woff2)$": "jest-transform-stub"
34 | }
35 | },
36 | "peerDependencies": {
37 | "prop-types": "^15.5.4",
38 | "react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
39 | "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
40 | },
41 | "devDependencies": {
42 | "@babel/cli": "^7.11.6",
43 | "@babel/core": "^7.11.6",
44 | "@babel/plugin-proposal-class-properties": "^7.10.4",
45 | "@babel/plugin-proposal-object-rest-spread": "^7.11.0",
46 | "@babel/preset-env": "^7.11.5",
47 | "@babel/preset-react": "^7.10.4",
48 | "@commitlint/cli": "^11.0.0",
49 | "@commitlint/config-conventional": "^11.0.0",
50 | "babel-eslint": "^10.1.0",
51 | "chalk": "^4.1.0",
52 | "cross-env": "^7.0.2",
53 | "eslint": "^7.11.0",
54 | "eslint-plugin-react": "^7.21.4",
55 | "fs-extra": "^9.0.1",
56 | "husky": "^4.3.0",
57 | "identity-obj-proxy": "^3.0.0",
58 | "jest": "^24.9.0",
59 | "jest-transform-stub": "^2.0.0",
60 | "lint-staged": "^10.4.0",
61 | "mini-css-extract-plugin": "^0.8.2",
62 | "node-sass": "^4.14.1",
63 | "npm-run-all": "^4.1.5",
64 | "prettier": "^2.1.2",
65 | "prettier-eslint-cli": "^5.0.0",
66 | "prop-types": "^15.5.4",
67 | "react": "^16.13.1",
68 | "react-dom": "^16.13.1",
69 | "react-test-renderer": "^16.13.1",
70 | "rimraf": "^3.0.2",
71 | "rollup": "^1.32.1",
72 | "rollup-plugin-babel": "^4.4.0",
73 | "rollup-plugin-commonjs": "^10.1.0",
74 | "rollup-plugin-node-resolve": "^5.2.0",
75 | "rollup-plugin-peer-deps-external": "^2.2.3",
76 | "rollup-plugin-postcss": "^2.9.0",
77 | "rollup-plugin-svg": "^2.0.0",
78 | "rollup-plugin-terser": "^6.1.0",
79 | "standard-version": "^9.0.0"
80 | },
81 | "engines": {
82 | "node": ">=8",
83 | "npm": ">=5"
84 | },
85 | "keywords": [
86 | "react",
87 | "faq",
88 | "accordion",
89 | "collapsible",
90 | "questions"
91 | ],
92 | "author": "Binod (binodswain@github.io)",
93 | "license": "MIT",
94 | "homepage": "https://github.com/binodswain/react-faq-component#readme",
95 | "lint-staged": {
96 | "*.scss": [
97 | "prettier --write"
98 | ],
99 | "*.{js,jsx,mjs,md,json,yml}": [
100 | "prettier-eslint --write"
101 | ]
102 | },
103 | "husky": {
104 | "hooks": {
105 | "pre-commit": "lint-staged",
106 | "commit-message": "commitlint -E HUSKY_GIT_PARAMS"
107 | }
108 | },
109 | "standard-version": {
110 | "skip": {
111 | "changelog": true
112 | }
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import babel from "rollup-plugin-babel";
2 | import resolve from "rollup-plugin-node-resolve";
3 | import commonjs from "rollup-plugin-commonjs";
4 | import postcss from "rollup-plugin-postcss";
5 | import peerDepsExternal from "rollup-plugin-peer-deps-external";
6 | import svg from "rollup-plugin-svg";
7 | import { terser } from "rollup-plugin-terser";
8 | import pkg from "./package.json";
9 |
10 | const isProd = process.env.NODE_ENV === "production";
11 |
12 | export default {
13 | input: "./src/index.js",
14 | output: [
15 | {
16 | file: pkg.main,
17 | format: "cjs",
18 | sourcemap: !isProd,
19 | },
20 | {
21 | file: pkg.module,
22 | format: "es",
23 | sourcemap: !isProd,
24 | },
25 | ],
26 | plugins: [
27 | svg(),
28 | peerDepsExternal(),
29 | babel(),
30 | postcss({
31 | extract: false,
32 | modules: true,
33 | use: ["sass"],
34 | }),
35 | resolve(),
36 | commonjs(),
37 | isProd && terser(),
38 | ],
39 | };
40 |
--------------------------------------------------------------------------------
/scripts/update_website.js:
--------------------------------------------------------------------------------
1 | // const { exec } = require("child_process");
2 | const fsExtra = require("fs-extra");
3 | const path = require("path");
4 | const execSync = require("child_process").execSync;
5 | const chalk = require("chalk");
6 | // eslint-disable-next-line no-console
7 | const log = console.log;
8 | const pkg = require("../package.json");
9 |
10 | function exec(cmd) {
11 | execSync(cmd, { stdio: "inherit", env: process.env });
12 | }
13 |
14 | function run(command) {
15 | log(chalk.white.bgBlue.bold(`[info] started - ${command}`));
16 |
17 | exec(command, (error, stdout, stderr) => {
18 | if (error) {
19 | log(`got error: ${error.message}`);
20 | return;
21 | }
22 | if (stderr) {
23 | log(`stderr: ${stderr}`);
24 | return;
25 | }
26 | });
27 |
28 | log(chalk.white.bgBlue.bold(`[info] finished - ${command}`));
29 | log("\n");
30 | }
31 |
32 | const cwd = process.cwd();
33 |
34 | const docsDir = path.join(__dirname + "/../docs");
35 | const rootDir = path.join(__dirname + "/../");
36 | const websiteDir = path.resolve(__dirname + "/../website");
37 | const websiteBuildDir = path.resolve(__dirname + "/../website/public");
38 |
39 | fsExtra.emptyDirSync(docsDir);
40 |
41 | // pull latest changes from master
42 | log(chalk.white.bgBlue(`[info] pull latest changes from master`));
43 | run(`git pull origin master`);
44 |
45 | // build package again
46 | run("npm run build");
47 |
48 | // go to website folder
49 | process.chdir(websiteDir);
50 | log(chalk.white.bgBlue(`[info] change directory to website`));
51 |
52 | // [website] - run clean install
53 | run("npm ci");
54 |
55 | // [website] - clean
56 | run("npm run clean");
57 |
58 | // [website] - build
59 | run("npm run build-path");
60 |
61 | // change working folder
62 | process.chdir(cwd);
63 | log(chalk.white.bgBlue(`[info] change directory to root`));
64 |
65 | // copy build files to docs folder
66 | fsExtra.copySync(websiteBuildDir, docsDir);
67 |
68 | // switch to root folder
69 | process.chdir(rootDir);
70 |
71 | // add commit
72 | run(`git add -- ./docs`);
73 |
74 | run(`git commit -m "docs: update demo website"`);
75 |
76 | run(`git push origin master`);
77 |
78 | log(chalk.white.bgBlue.bold("Pushed updated site to master/docs"));
79 | log(chalk.green(`Published at : ${pkg.homepage}`));
80 |
81 | log("\n");
82 |
--------------------------------------------------------------------------------
/src/__mock__/fileMock.js:
--------------------------------------------------------------------------------
1 | module.exports = "test-file-stub";
2 |
--------------------------------------------------------------------------------
/src/__mock__/styleMock.js:
--------------------------------------------------------------------------------
1 | module.exports = {};
2 |
--------------------------------------------------------------------------------
/src/assets/arrow_down.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/events.js:
--------------------------------------------------------------------------------
1 | const evt = {
2 | return: 13,
3 | arrowLeft: 37,
4 | arrowUp: 38,
5 | arrowRight: 39,
6 | arrowDown: 40,
7 | space: 32,
8 | };
9 |
10 | evt.keyCodes = Object.keys(evt).reduce((obj, name) => {
11 | obj[evt[name]] = name;
12 | return obj;
13 | }, {});
14 |
15 | export default evt;
16 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import PropTypes from "prop-types";
3 | import FaqRow from "./rowItem";
4 | import style from "./styles.scss";
5 |
6 | export default class FaqComponent extends PureComponent {
7 | static propTypes = {
8 | data: PropTypes.object,
9 | styles: PropTypes.object,
10 | config: PropTypes.object,
11 | getRowOptions: PropTypes.func,
12 | };
13 |
14 | state = {
15 | rowsOption: [],
16 | };
17 |
18 | componentDidMount() {
19 | if (this.props.getRowOptions) {
20 | this.props.getRowOptions(this.state.rowsOption);
21 | }
22 | }
23 |
24 | render() {
25 | const { title, rows = [] } = this.props.data || {};
26 | const { styles = {}, config: { animate, openOnload } = {} } = this.props;
27 |
28 | const styleConfig = {
29 | "--faq-bg-color": styles.bgColor,
30 | "--title-text-color": styles.titleTextColor,
31 | "--title-text-size": styles.titleTextSize,
32 | "--row-title-color": styles.rowTitleColor,
33 | "--row-title-text-size": styles.rowTitleTextSize,
34 | "--row-content-color": styles.rowContentColor,
35 | "--row-content-text-size": styles.rowContentTextSize,
36 | "--row-content-padding-top": styles.rowContentPaddingTop,
37 | "--row-content-padding-bottom": styles.rowContentPaddingBottom,
38 | "--row-content-padding-right": styles.rowContentPaddingRight,
39 | "--row-content-padding-left": styles.rowContentPaddingLeft,
40 | "--arrow-color": styles.arrowColor,
41 | "--transition-duration": styles.transitionDuration,
42 | "--timing-function": styles.timingFunc,
43 | };
44 |
45 | const wrapperClass = `faq-row-wrapper ${style["faq-row-wrapper"]}`;
46 | const titleClass = `faq-title ${style["faq-row"]}`;
47 | const rowlistClass = `faq-body ${style["row-body"]}`;
48 |
49 | return (
50 |
51 | {title ? (
52 |
55 | ) : null}
56 | {rows.length ? (
57 |
58 | {rows.map((row, i) => {
59 | return (
60 |
67 | // eslint-disable-next-line react/no-direct-mutation-state
68 | (this.state.rowsOption[i] = options)
69 | }
70 | />
71 | );
72 | })}
73 |
74 | ) : null}
75 |
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/rowItem.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import PropTypes from "prop-types";
3 | import keyboardEvents from "./events";
4 | import style from "./styles.scss";
5 | import arrow_down from "./assets/arrow_down.svg";
6 |
7 | export default class rowItem extends PureComponent {
8 | static propTypes = {
9 | config: PropTypes.object,
10 | data: PropTypes.object,
11 | rowid: PropTypes.number,
12 | getRowOptions: PropTypes.func,
13 | openOnload: PropTypes.bool,
14 | };
15 |
16 | state = {
17 | isExpanded: false,
18 | ref: React.createRef(),
19 | rowRef: React.createRef(),
20 | height: 0,
21 | rowClassName: "closed",
22 | };
23 |
24 | getSnapshotBeforeUpdate(prevProps, prevState) {
25 | const { isExpanded: wasOpen } = prevState;
26 | const { isExpanded: isOpen } = this.state;
27 | const { config: { animate = true } = {} } = this.props;
28 |
29 | let rowClassName;
30 | if (isOpen !== wasOpen) {
31 | if (isOpen) {
32 | rowClassName = animate ? "expanding" : "expanded";
33 | } else {
34 | rowClassName = animate ? "closing" : "closed";
35 | }
36 |
37 | return {
38 | rowClassName,
39 | };
40 | }
41 | return null;
42 | }
43 |
44 | finishTransition = () => {
45 | const { isExpanded: isOpen } = this.state;
46 | this.setState({ rowClassName: isOpen ? "expanded" : "closed" });
47 | };
48 |
49 | componentDidUpdate(prevProps, prevState, snapshot) {
50 | const { config: { animate = true } = {} } = this.props;
51 | if (snapshot !== null) {
52 | this.setState(
53 | {
54 | ...snapshot,
55 | },
56 | animate ? this.setHeight : undefined,
57 | );
58 | }
59 | }
60 |
61 | componentDidMount() {
62 | const { rowRef } = this.state;
63 | if (this.props.openOnload) {
64 | this.expand();
65 | }
66 |
67 | if (this.props.getRowOptions) {
68 | const options = {
69 | expand: () => {
70 | this.toggle(true);
71 | },
72 | close: () => {
73 | this.toggle(false);
74 | },
75 | scrollIntoView: (opt) => {
76 | if (opt) {
77 | rowRef.current.scrollIntoView(opt);
78 | } else {
79 | rowRef.current.scrollIntoView();
80 | }
81 | },
82 | };
83 | this.props.getRowOptions(options);
84 | }
85 | }
86 |
87 | toggle = (flag) => {
88 | this.setState(() => {
89 | return { isExpanded: flag };
90 | });
91 | };
92 |
93 | expand = () => {
94 | this.setState((prevState) => {
95 | return { isExpanded: !prevState.isExpanded };
96 | });
97 | };
98 |
99 | keyPress = (event) => {
100 | const code = event.keyCode ? event.keyCode : event.which;
101 |
102 | switch (keyboardEvents.keyCodes[code]) {
103 | case "space":
104 | case "return":
105 | event.preventDefault();
106 | event.stopPropagation();
107 | this.expand();
108 | break;
109 | default:
110 | break;
111 | }
112 | };
113 |
114 | setHeight = () => {
115 | const { ref, isExpanded } = this.state;
116 | const height = ref.current.scrollHeight;
117 | this.setState({
118 | height: isExpanded ? height : 0,
119 | });
120 | };
121 |
122 | render() {
123 | const {
124 | data: { title, content },
125 | config: { animate = true, arrowIcon, expandIcon, collapseIcon, tabFocus = false } = {},
126 | } = this.props;
127 |
128 | const { isExpanded, ref, height, rowClassName, rowRef } = this.state;
129 |
130 | const attrs = {
131 | onClick: this.expand,
132 | role: "button",
133 | "aria-expanded": isExpanded,
134 | "aria-controls": `react-faq-rowcontent-${this.props.rowid}`,
135 | // tabIndex: 0,
136 | onKeyPress: this.keyPress,
137 | onKeyDown: this.keyPress,
138 | };
139 |
140 | if (tabFocus) {
141 | attrs.tabIndex = 0;
142 | }
143 |
144 | const contentAttrs = {
145 | role: "region",
146 | id: `react-faq-rowcontent-${this.props.rowid}`,
147 | "aria-expanded": isExpanded,
148 | "aria-hidden": !isExpanded,
149 | onTransitionEnd: this.finishTransition,
150 | };
151 |
152 | if (animate) {
153 | contentAttrs["style"] = {
154 | height,
155 | };
156 | }
157 |
158 | const className = [
159 | "row-title",
160 | rowClassName,
161 | style["row-title"],
162 | style[rowClassName],
163 | tabFocus ? "" : style["no-tabfocus"],
164 | ]
165 | .filter(Boolean)
166 | .join(" ");
167 |
168 | const customIcon = expandIcon && collapseIcon;
169 | let icon = null;
170 | if (customIcon) {
171 | icon = isExpanded ? collapseIcon : expandIcon;
172 | } else {
173 | icon = arrowIcon || (
174 |
179 | );
180 | }
181 |
182 | const contentClasses = [
183 | style["row-content"],
184 | "row-content",
185 | animate ? style["animate"] : style["static"],
186 | ].join(" ");
187 |
188 | const contentTextClasses = [style["row-content-text"], "row-content-text"].join(" ");
189 | const rowItem =
190 | content && typeof content === "string" ? (
191 |
192 | ) : (
193 | {content}
194 | );
195 |
196 | return (
197 |
198 |
199 |
203 | {title}
204 |
205 |
206 | {icon}
207 |
208 |
209 |
210 | {rowItem}
211 |
212 |
213 | );
214 | }
215 | }
216 |
--------------------------------------------------------------------------------
/src/styles.scss:
--------------------------------------------------------------------------------
1 | $default-color: black;
2 | $white: white;
3 | $default-title-size: 30px;
4 | $default-row-title-size: large;
5 | $default-row-content-size: medium;
6 | $default-duration: 0.3s;
7 | $default-timing-function: ease;
8 |
9 | @mixin transition {
10 | transition: height var(--transition-duration, $default-duration);
11 | transition-timing-function: var(--timing-function, $default-timing-function);
12 | }
13 |
14 | .faq-row-wrapper {
15 | background-color: var(--faq-bg-color, $white);
16 | h2 {
17 | margin: 0;
18 | color: var(--title-text-color, $default-color);
19 | font-size: var(--title-text-size, $default-title-size);
20 | }
21 | .faq-row {
22 | display: flex;
23 | justify-content: space-between;
24 | padding: 5px 0;
25 | border-bottom: 1px solid #ccc;
26 | }
27 |
28 | .row-body {
29 | .faq-row {
30 | flex-direction: column;
31 | position: relative;
32 |
33 | .row-title {
34 | padding: 10px 0;
35 | display: flex;
36 | justify-content: space-between;
37 | color: var(--row-title-color, $default-color);
38 | font-size: var(--row-title-text-size, $default-row-title-size);
39 | cursor: pointer;
40 | align-items: center;
41 |
42 | &.no-tabfocus {
43 | outline: none;
44 | }
45 |
46 | .row-title-text {
47 | padding-right: 3em;
48 | }
49 |
50 | .icon-wrapper {
51 | max-width: 25px;
52 | max-height: 25px;
53 | margin: 0;
54 | padding: 0;
55 | color: var(--arrow-color, $default-color);
56 | transform: rotate(0deg);
57 | transition: transform var(--transition-duration, $default-duration);
58 | position: absolute;
59 | top: 13px;
60 | right: 12px;
61 |
62 | // .arrow-image,
63 | svg {
64 | width: 100%;
65 | height: 100%;
66 | }
67 |
68 | svg {
69 | fill: var(--arrow-color, $default-color);
70 | }
71 | }
72 |
73 | &.closed {
74 | + .row-content {
75 | visibility: hidden;
76 |
77 | &.animate {
78 | opacity: 0;
79 | transition: height var(--transition-duration, $default-duration);
80 | }
81 |
82 | &.static {
83 | display: none;
84 | }
85 | }
86 | }
87 |
88 | &.expanded {
89 | + .row-content {
90 | visibility: visible;
91 |
92 | &.static {
93 | display: block;
94 | }
95 | }
96 |
97 | .icon-wrapper {
98 | transform: rotate(180deg);
99 | }
100 | }
101 | &.expanding {
102 | .icon-wrapper {
103 | transform: rotate(180deg);
104 | }
105 | }
106 | }
107 |
108 | .row-content {
109 | overflow: hidden;
110 | @include transition;
111 |
112 | .row-content-text {
113 | color: var(--row-content-color, $default-color);
114 | font-size: var(--row-content-text-size, $default-row-content-size);
115 | padding: var(--row-content-padding-top, 0) var(--row-content-padding-right, 0)
116 | var(--row-content-padding-bottom, 0) var(--row-content-padding-left, 0);
117 | }
118 | }
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/src/test.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import Faq from "./";
3 | import TestRenderer from "react-test-renderer";
4 | import ReactTestUtils from "react-dom/test-utils";
5 | import ReactDOM from "react-dom";
6 | import { act } from "react-dom/test-utils";
7 |
8 | const data = {
9 | title: "FAQ (How it works)",
10 | rows: [
11 | {
12 | title: "Lorem ipsum dolor sit amet,",
13 | content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempo.
14 | Aenean vel turpis feugiat, ultricies metus at, consequat velit. Curabitur est nibh,
15 | varius in tellus nec, mattis pulvinar metus. In maximus cursus lorem, nec laoreet
16 | velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
17 | Fusce sed commodo purus, at tempus turpis.`,
18 | },
19 | {
20 | title: "Nunc maximus, magna at ultricies elementum",
21 | content: `Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam,
22 | vitae convallis ex tortor sed dolor.`,
23 | },
24 | {
25 | title: "Can I use html as content",
26 | content: `Yes, here is an example of
27 | a link `,
28 | },
29 | {
30 | title: "What is the package version",
31 | content: "v1.0.0",
32 | },
33 | ],
34 | };
35 |
36 | describe("FAQ component setup", () => {
37 | const testRenderer = TestRenderer.create( );
38 | const testRendererEmpty = TestRenderer.create( );
39 | it("is truthy", () => {
40 | expect(Faq).toBeTruthy();
41 | });
42 |
43 | it("should render FAQ with child element", () => {
44 | const comp = testRenderer.toJSON();
45 | expect(comp.children.length).toEqual(2);
46 | });
47 |
48 | it("should render FAQ with no child element", () => {
49 | const comp = testRendererEmpty.toJSON();
50 | expect(comp.children).toEqual(null);
51 | });
52 | });
53 |
54 | describe("Accessibility attribute", () => {
55 | let container;
56 | let faqBody;
57 | let firstRow;
58 | let rowTitle;
59 | let rowContent;
60 |
61 | beforeEach(() => {
62 | container = document.createElement("div");
63 | document.body.appendChild(container);
64 |
65 | // Test first render and componentDidMount
66 | act(() => {
67 | ReactDOM.render( , container);
68 | });
69 | faqBody = container.querySelector("section.faq-body");
70 | firstRow = faqBody.children[0];
71 | rowTitle = firstRow.querySelector(".row-title");
72 | rowContent = firstRow.querySelector(".row-content");
73 | });
74 |
75 | afterEach(() => {
76 | document.body.removeChild(container);
77 | container = null;
78 | });
79 |
80 | it(" should render a row with all required ARIA attributes", () => {
81 | expect(rowTitle.getAttribute("aria-expanded")).toBe("false");
82 | expect(rowTitle.getAttribute("aria-controls")).toBe(rowContent.id);
83 | expect(rowContent.getAttribute("aria-hidden")).toBe("true");
84 | expect(rowContent.getAttribute("aria-expanded")).toBe("false");
85 | });
86 |
87 | it("should update ARIA attributes after click event ", () => {
88 | // Test second render and componentDidUpdate
89 | // expand the row item
90 | act(() => {
91 | rowTitle.dispatchEvent(new MouseEvent("click", { bubbles: true }));
92 | });
93 |
94 | expect(rowTitle.getAttribute("aria-expanded")).toBe("true");
95 | expect(rowTitle.getAttribute("aria-controls")).toBe(rowContent.id);
96 | expect(rowContent.getAttribute("aria-hidden")).toBe("false");
97 | expect(rowContent.getAttribute("aria-expanded")).toBe("true");
98 | });
99 |
100 | it("should update ARIA attributes after keyboard space event ", () => {
101 | // Test second render and componentDidUpdate
102 | // expand the row item
103 | act(() => {
104 | ReactTestUtils.Simulate.keyPress(rowTitle, { keyCode: 32 });
105 | });
106 |
107 | expect(rowTitle.getAttribute("aria-expanded")).toBe("true");
108 | expect(rowTitle.getAttribute("aria-controls")).toBe(rowContent.id);
109 | expect(rowContent.getAttribute("aria-hidden")).toBe("false");
110 | expect(rowContent.getAttribute("aria-expanded")).toBe("true");
111 |
112 | // Close expanded rowitem
113 | act(() => {
114 | ReactTestUtils.Simulate.keyPress(rowTitle, { keyCode: 32 });
115 | });
116 |
117 | expect(rowTitle.getAttribute("aria-expanded")).toBe("false");
118 | expect(rowTitle.getAttribute("aria-controls")).toBe(rowContent.id);
119 | expect(rowContent.getAttribute("aria-hidden")).toBe("true");
120 | expect(rowContent.getAttribute("aria-expanded")).toBe("false");
121 | });
122 |
123 | it("should update ARIA attributes after keyboard enter event ", () => {
124 | // Test second render and componentDidUpdate
125 | // expand the row item
126 | act(() => {
127 | ReactTestUtils.Simulate.keyPress(rowTitle, { keyCode: 13 });
128 | });
129 |
130 | expect(rowTitle.getAttribute("aria-expanded")).toBe("true");
131 | expect(rowTitle.getAttribute("aria-controls")).toBe(rowContent.id);
132 | expect(rowContent.getAttribute("aria-hidden")).toBe("false");
133 | expect(rowContent.getAttribute("aria-expanded")).toBe("true");
134 |
135 | // Close expanded rowitem
136 | act(() => {
137 | ReactTestUtils.Simulate.keyPress(rowTitle, { keyCode: 13 });
138 | });
139 | expect(rowTitle.getAttribute("aria-expanded")).toBe("false");
140 | expect(rowTitle.getAttribute("aria-controls")).toBe(rowContent.id);
141 | expect(rowContent.getAttribute("aria-hidden")).toBe("true");
142 | expect(rowContent.getAttribute("aria-expanded")).toBe("false");
143 | });
144 | });
145 |
--------------------------------------------------------------------------------
/website/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["babel-preset-gatsby"],
3 | "plugins": [
4 | ["prismjs", {
5 | "languages": ["javascript", "css", "markup", "json", "jsx"],
6 | // "plugins": ["show-language"],
7 | "theme": "tomorrow",
8 | "css": true
9 | }]
10 | ]
11 | }
--------------------------------------------------------------------------------
/website/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Runtime data
9 | pids
10 | *.pid
11 | *.seed
12 | *.pid.lock
13 |
14 | # Directory for instrumented libs generated by jscoverage/JSCover
15 | lib-cov
16 |
17 | # Coverage directory used by tools like istanbul
18 | coverage
19 |
20 | # nyc test coverage
21 | .nyc_output
22 |
23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24 | .grunt
25 |
26 | # Bower dependency directory (https://bower.io/)
27 | bower_components
28 |
29 | # node-waf configuration
30 | .lock-wscript
31 |
32 | # Compiled binary addons (http://nodejs.org/api/addons.html)
33 | build/Release
34 |
35 | # Dependency directories
36 | node_modules/
37 | jspm_packages/
38 |
39 | # Typescript v1 declaration files
40 | typings/
41 |
42 | # Optional npm cache directory
43 | .npm
44 |
45 | # Optional eslint cache
46 | .eslintcache
47 |
48 | # Optional REPL history
49 | .node_repl_history
50 |
51 | # Output of 'npm pack'
52 | *.tgz
53 |
54 | # dotenv environment variable files
55 | .env*
56 |
57 | # gatsby files
58 | .cache/
59 | public
60 |
61 | # Mac files
62 | .DS_Store
63 |
64 | # Yarn
65 | yarn-error.log
66 | .pnp/
67 | .pnp.js
68 | # Yarn Integrity file
69 | .yarn-integrity
70 |
--------------------------------------------------------------------------------
/website/.prettierignore:
--------------------------------------------------------------------------------
1 | .cache
2 | package.json
3 | package-lock.json
4 | public
5 |
--------------------------------------------------------------------------------
/website/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "endOfLine": "lf",
3 | "semi": false,
4 | "singleQuote": false,
5 | "tabWidth": 2,
6 | "trailingComma": "es5"
7 | }
8 |
--------------------------------------------------------------------------------
/website/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 gatsbyjs
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/website/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/website/README.md
--------------------------------------------------------------------------------
/website/gatsby-browser.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Implement Gatsby's Browser APIs in this file.
3 | *
4 | * See: https://www.gatsbyjs.org/docs/browser-apis/
5 | */
6 |
7 | // You can delete this file if you're not using it
8 |
--------------------------------------------------------------------------------
/website/gatsby-config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | pathPrefix: "/react-faq-component",
3 | siteMetadata: {
4 | title: `react-faq-component`,
5 | description: `An accessible react package to render FAQ(frequently asked questions) in your React web app. Supports configurable parameters to customize as per requirement.`,
6 | author: `@swain_binod`,
7 | },
8 | plugins: [
9 | `gatsby-plugin-react-helmet`,
10 | {
11 | resolve: `gatsby-source-filesystem`,
12 | options: {
13 | name: `images`,
14 | path: `${__dirname}/src/images`,
15 | },
16 | },
17 | `gatsby-transformer-sharp`,
18 | `gatsby-plugin-sharp`,
19 | `gatsby-plugin-sass`,
20 | // {
21 | // resolve: `gatsby-plugin-manifest`,
22 | // options: {
23 | // name: `gatsby-starter-default`,
24 | // short_name: `starter`,
25 | // start_url: `/`,
26 | // background_color: `#663399`,
27 | // theme_color: `#663399`,
28 | // display: `minimal-ui`,
29 | // icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
30 | // },
31 | // }
32 | // this (optional) plugin enables Progressive Web App + Offline functionality
33 | // To learn more, visit: https://gatsby.dev/offline
34 | // `gatsby-plugin-offline`,
35 | ],
36 | }
37 |
--------------------------------------------------------------------------------
/website/gatsby-node.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Implement Gatsby's Node APIs in this file.
3 | *
4 | * See: https://www.gatsbyjs.org/docs/node-apis/
5 | */
6 |
7 | // You can delete this file if you're not using it
8 |
--------------------------------------------------------------------------------
/website/gatsby-ssr.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
3 | *
4 | * See: https://www.gatsbyjs.org/docs/ssr-apis/
5 | */
6 |
7 | // You can delete this file if you're not using it
8 |
--------------------------------------------------------------------------------
/website/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-faq-component-demo",
3 | "private": true,
4 | "description": "Website to show demo for react-faq-component",
5 | "version": "0.0.1",
6 | "author": "binodswain",
7 | "dependencies": {
8 | "babel-plugin-prismjs": "^1.1.1",
9 | "babel-preset-gatsby": "^0.2.36",
10 | "gatsby": "^2.24.2",
11 | "gatsby-image": "^2.4.13",
12 | "gatsby-plugin-manifest": "^2.4.18",
13 | "gatsby-plugin-offline": "^3.2.17",
14 | "gatsby-plugin-react-helmet": "^3.3.10",
15 | "gatsby-plugin-sass": "^2.3.12",
16 | "gatsby-plugin-sharp": "^2.6.19",
17 | "gatsby-source-filesystem": "^2.3.19",
18 | "gatsby-transformer-sharp": "^2.5.11",
19 | "node-sass": "^4.14.1",
20 | "prismjs": "^1.20.0",
21 | "prop-types": "^15.7.2",
22 | "react": "^16.13.1",
23 | "react-dom": "^16.13.1",
24 | "react-faq-component": "file:..",
25 | "react-helmet": "^5.2.1"
26 | },
27 | "devDependencies": {
28 | "prettier": "^1.19.1"
29 | },
30 | "keywords": [
31 | "gatsby"
32 | ],
33 | "license": "MIT",
34 | "scripts": {
35 | "build": "gatsby build",
36 | "build-path": "gatsby build --prefix-paths",
37 | "develop": "gatsby develop",
38 | "format": "prettier --write \"**/*.{js,jsx,json,md}\"",
39 | "start": "npm run develop",
40 | "serve": "gatsby serve",
41 | "clean": "gatsby clean",
42 | "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
43 | },
44 | "repository": {
45 | "type": "git",
46 | "url": "https://github.com/binodswain/react-faq-component"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/website/src/components/faqToggleOption.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from "react"
2 | import Faq from "react-faq-component"
3 |
4 | const data = {
5 | title: "FAQ (How it works)",
6 | rows: [
7 | {
8 | title:
9 | "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat",
10 | content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
11 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
12 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
13 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
14 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
15 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
16 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
17 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
18 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
19 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
20 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
21 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
22 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
23 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
24 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
25 | Fusce sed commodo purus, at tempus turpis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
26 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
27 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
28 | Fusce sed commodo purus, at tempus turpis.`,
29 | },
30 | {
31 | title: "Nunc maximus, magna at ultricies elementum",
32 | content:
33 | "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.",
34 | },
35 | {
36 | title: "Can I use html as content",
37 | content: `Yes, here is an example of a link `,
38 | },
39 | {
40 | title: "What is the package version",
41 | content: "v1.0.0",
42 | },
43 | ],
44 | }
45 |
46 | export default function App() {
47 | const [rows, setRowsOption] = useState(null)
48 | const [row, setRow] = useState(0)
49 |
50 | const expand = () => {
51 | rows && rows[row].expand()
52 | }
53 |
54 | const close = () => {
55 | rows && rows[row].close()
56 | }
57 |
58 | return (
59 |
60 |
61 | Enter row number:
62 | setRow(e.target.value)}
67 | min="0"
68 | max="3"
69 | disabled={!rows}
70 | />
71 |
72 | Exapnd row
73 |
74 |
75 |
76 | Close row
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | )
85 | }
86 |
--------------------------------------------------------------------------------
/website/src/components/footer.js:
--------------------------------------------------------------------------------
1 | import PropTypes from "prop-types"
2 | import React from "react"
3 |
4 | const Footer = () => {
5 | return (
6 |
26 | )
27 | }
28 |
29 | Footer.propTypes = {
30 | siteTitle: PropTypes.string,
31 | }
32 |
33 | Footer.defaultProps = {
34 | siteTitle: ``,
35 | }
36 |
37 | export default Footer
38 |
--------------------------------------------------------------------------------
/website/src/components/githubFork.js:
--------------------------------------------------------------------------------
1 | import React from "React"
2 | const gitHubFork = () => {
3 | return (
4 |
9 |
23 |
24 |
30 |
35 |
36 |
37 | )
38 | }
39 |
40 | export default gitHubFork
41 |
--------------------------------------------------------------------------------
/website/src/components/header.js:
--------------------------------------------------------------------------------
1 | import { useStaticQuery, graphql } from "gatsby"
2 | import PropTypes from "prop-types"
3 | import React from "react"
4 |
5 | const Header = () => {
6 | const data = useStaticQuery(graphql`
7 | query SiteTitleQuery {
8 | site {
9 | siteMetadata {
10 | title
11 | description
12 | }
13 | }
14 | }
15 | `)
16 |
17 | console.log(data)
18 | const { title, description } = data.site.siteMetadata
19 |
20 | return (
21 |
22 |
30 |
{title}
31 |
{description}
32 |
33 |
34 |
35 | )
36 | }
37 |
38 | Header.propTypes = {
39 | siteTitle: PropTypes.string,
40 | }
41 |
42 | Header.defaultProps = {
43 | siteTitle: ``,
44 | }
45 |
46 | export default Header
47 |
--------------------------------------------------------------------------------
/website/src/components/image.js:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import { useStaticQuery, graphql } from "gatsby"
3 | import Img from "gatsby-image"
4 |
5 | /*
6 | * This component is built using `gatsby-image` to automatically serve optimized
7 | * images with lazy loading and reduced file sizes. The image is loaded using a
8 | * `useStaticQuery`, which allows us to load the image from directly within this
9 | * component, rather than having to pass the image data down from pages.
10 | *
11 | * For more information, see the docs:
12 | * - `gatsby-image`: https://gatsby.dev/gatsby-image
13 | * - `useStaticQuery`: https://www.gatsbyjs.org/docs/use-static-query/
14 | */
15 |
16 | const Image = () => {
17 | const data = useStaticQuery(graphql`
18 | query {
19 | placeholderImage: file(relativePath: { eq: "ss_1.png" }) {
20 | childImageSharp {
21 | fluid(maxWidth: 1000) {
22 | ...GatsbyImageSharpFluid
23 | }
24 | }
25 | }
26 | }
27 | `)
28 |
29 | return
30 | }
31 |
32 | export default Image
33 |
--------------------------------------------------------------------------------
/website/src/components/index.css:
--------------------------------------------------------------------------------
1 | .badges a {
2 | padding-right: 5px;
3 | }
4 |
5 | .github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}
6 |
7 | .github-corner svg{
8 | fill: var(--fork-color)
9 | }
10 | section {
11 | padding-bottom: 20px;
12 | }
13 |
--------------------------------------------------------------------------------
/website/src/components/layout.css:
--------------------------------------------------------------------------------
1 | /* @import url('https://fonts.googleapis.com/css?family=Roboto'); */
2 |
3 | html {
4 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
5 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
6 | -ms-text-size-adjust: 100%;
7 | -webkit-text-size-adjust: 100%;
8 | }
9 | body {
10 | margin: 0;
11 | -webkit-font-smoothing: antialiased;
12 | -moz-osx-font-smoothing: grayscale;
13 | }
14 | article,
15 | aside,
16 | details,
17 | figcaption,
18 | figure,
19 | footer,
20 | header,
21 | main,
22 | menu,
23 | nav,
24 | section,
25 | summary {
26 | display: block;
27 | }
28 | audio,
29 | canvas,
30 | progress,
31 | video {
32 | display: inline-block;
33 | }
34 | audio:not([controls]) {
35 | display: none;
36 | height: 0;
37 | }
38 | progress {
39 | vertical-align: baseline;
40 | }
41 | [hidden],
42 | template {
43 | display: none;
44 | }
45 | a {
46 | background-color: transparent;
47 | -webkit-text-decoration-skip: objects;
48 | }
49 | a:active,
50 | a:hover {
51 | outline-width: 0;
52 | }
53 | abbr[title] {
54 | border-bottom: none;
55 | text-decoration: underline;
56 | text-decoration: underline dotted;
57 | }
58 | b,
59 | strong {
60 | font-weight: inherit;
61 | font-weight: bolder;
62 | }
63 | dfn {
64 | font-style: italic;
65 | }
66 | h1 {
67 | font-size: 2em;
68 | margin: 0.67em 0;
69 | }
70 | mark {
71 | background-color: #ff0;
72 | color: #000;
73 | }
74 | small {
75 | font-size: 80%;
76 | }
77 | sub,
78 | sup {
79 | font-size: 75%;
80 | line-height: 0;
81 | position: relative;
82 | vertical-align: baseline;
83 | }
84 | sub {
85 | bottom: -0.25em;
86 | }
87 | sup {
88 | top: -0.5em;
89 | }
90 | img {
91 | border-style: none;
92 | }
93 | svg:not(:root) {
94 | overflow: hidden;
95 | }
96 | code,
97 | kbd,
98 | pre,
99 | samp {
100 | font-family: monospace, monospace;
101 | font-size: 1em;
102 | }
103 | figure {
104 | margin: 1em 40px;
105 | }
106 | hr {
107 | box-sizing: content-box;
108 | height: 0;
109 | overflow: visible;
110 | }
111 | button,
112 | input,
113 | optgroup,
114 | select,
115 | textarea {
116 | font: inherit;
117 | margin: 0;
118 | }
119 | optgroup {
120 | font-weight: 700;
121 | }
122 | button,
123 | input {
124 | overflow: visible;
125 | }
126 | button,
127 | select {
128 | text-transform: none;
129 | }
130 | [type="reset"],
131 | [type="submit"],
132 | button,
133 | html [type="button"] {
134 | -webkit-appearance: button;
135 | }
136 | [type="button"]::-moz-focus-inner,
137 | [type="reset"]::-moz-focus-inner,
138 | [type="submit"]::-moz-focus-inner,
139 | button::-moz-focus-inner {
140 | border-style: none;
141 | padding: 0;
142 | }
143 | [type="button"]:-moz-focusring,
144 | [type="reset"]:-moz-focusring,
145 | [type="submit"]:-moz-focusring,
146 | button:-moz-focusring {
147 | outline: 1px dotted ButtonText;
148 | }
149 | fieldset {
150 | border: 1px solid silver;
151 | margin: 0 2px;
152 | padding: 0.35em 0.625em 0.75em;
153 | }
154 | legend {
155 | box-sizing: border-box;
156 | color: inherit;
157 | display: table;
158 | max-width: 100%;
159 | padding: 0;
160 | white-space: normal;
161 | }
162 | textarea {
163 | overflow: auto;
164 | }
165 | [type="checkbox"],
166 | [type="radio"] {
167 | box-sizing: border-box;
168 | padding: 0;
169 | }
170 | [type="number"]::-webkit-inner-spin-button,
171 | [type="number"]::-webkit-outer-spin-button {
172 | height: auto;
173 | }
174 | [type="search"] {
175 | -webkit-appearance: textfield;
176 | outline-offset: -2px;
177 | }
178 | [type="search"]::-webkit-search-cancel-button,
179 | [type="search"]::-webkit-search-decoration {
180 | -webkit-appearance: none;
181 | }
182 | ::-webkit-input-placeholder {
183 | color: inherit;
184 | opacity: 0.54;
185 | }
186 | ::-webkit-file-upload-button {
187 | -webkit-appearance: button;
188 | font: inherit;
189 | }
190 | html {
191 | font: 112.5%/1.45em georgia, serif;
192 | box-sizing: border-box;
193 | overflow-y: scroll;
194 | }
195 | * {
196 | box-sizing: inherit;
197 | }
198 | *:before {
199 | box-sizing: inherit;
200 | }
201 | *:after {
202 | box-sizing: inherit;
203 | }
204 | body {
205 | color: hsla(0, 0%, 0%, 0.8);
206 | /* font-family: georgia, serif; */
207 | font-weight: normal;
208 | word-wrap: break-word;
209 | font-kerning: normal;
210 | -moz-font-feature-settings: "kern", "liga", "clig", "calt";
211 | -ms-font-feature-settings: "kern", "liga", "clig", "calt";
212 | -webkit-font-feature-settings: "kern", "liga", "clig", "calt";
213 | font-feature-settings: "kern", "liga", "clig", "calt";
214 | }
215 | img {
216 | max-width: 100%;
217 | margin-left: 0;
218 | margin-right: 0;
219 | margin-top: 0;
220 | padding-bottom: 0;
221 | padding-left: 0;
222 | padding-right: 0;
223 | padding-top: 0;
224 | margin-bottom: 1.45rem;
225 | }
226 | h1 {
227 | margin-left: 0;
228 | margin-right: 0;
229 | margin-top: 0;
230 | padding-bottom: 0;
231 | padding-left: 0;
232 | padding-right: 0;
233 | padding-top: 0;
234 | margin-bottom: 1.45rem;
235 | color: inherit;
236 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
237 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
238 | font-weight: bold;
239 | text-rendering: optimizeLegibility;
240 | font-size: 2.25rem;
241 | line-height: 1.1;
242 | }
243 | h2 {
244 | margin-left: 0;
245 | margin-right: 0;
246 | margin-top: 0;
247 | padding-bottom: 0;
248 | padding-left: 0;
249 | padding-right: 0;
250 | padding-top: 0;
251 | margin-bottom: 1.45rem;
252 | color: inherit;
253 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
254 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
255 | font-weight: bold;
256 | text-rendering: optimizeLegibility;
257 | font-size: 1.62671rem;
258 | line-height: 1.1;
259 | }
260 | h3 {
261 | margin-left: 0;
262 | margin-right: 0;
263 | margin-top: 0;
264 | padding-bottom: 0;
265 | padding-left: 0;
266 | padding-right: 0;
267 | padding-top: 0;
268 | margin-bottom: 1.45rem;
269 | color: inherit;
270 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
271 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
272 | font-weight: bold;
273 | text-rendering: optimizeLegibility;
274 | font-size: 1.38316rem;
275 | line-height: 1.1;
276 | }
277 | h4 {
278 | margin-left: 0;
279 | margin-right: 0;
280 | margin-top: 0;
281 | padding-bottom: 0;
282 | padding-left: 0;
283 | padding-right: 0;
284 | padding-top: 0;
285 | margin-bottom: 1.45rem;
286 | color: inherit;
287 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
288 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
289 | font-weight: bold;
290 | text-rendering: optimizeLegibility;
291 | font-size: 1rem;
292 | line-height: 1.1;
293 | }
294 | h5 {
295 | margin-left: 0;
296 | margin-right: 0;
297 | margin-top: 0;
298 | padding-bottom: 0;
299 | padding-left: 0;
300 | padding-right: 0;
301 | padding-top: 0;
302 | margin-bottom: 1.45rem;
303 | color: inherit;
304 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
305 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
306 | font-weight: bold;
307 | text-rendering: optimizeLegibility;
308 | font-size: 0.85028rem;
309 | line-height: 1.1;
310 | }
311 | h6 {
312 | margin-left: 0;
313 | margin-right: 0;
314 | margin-top: 0;
315 | padding-bottom: 0;
316 | padding-left: 0;
317 | padding-right: 0;
318 | padding-top: 0;
319 | margin-bottom: 1.45rem;
320 | color: inherit;
321 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
322 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
323 | font-weight: bold;
324 | text-rendering: optimizeLegibility;
325 | font-size: 0.78405rem;
326 | line-height: 1.1;
327 | }
328 | hgroup {
329 | margin-left: 0;
330 | margin-right: 0;
331 | margin-top: 0;
332 | padding-bottom: 0;
333 | padding-left: 0;
334 | padding-right: 0;
335 | padding-top: 0;
336 | margin-bottom: 1.45rem;
337 | }
338 | ul {
339 | margin-left: 1.45rem;
340 | margin-right: 0;
341 | margin-top: 0;
342 | padding-bottom: 0;
343 | padding-left: 0;
344 | padding-right: 0;
345 | padding-top: 0;
346 | margin-bottom: 1.45rem;
347 | list-style-position: outside;
348 | list-style-image: none;
349 | }
350 | ol {
351 | margin-left: 1.45rem;
352 | margin-right: 0;
353 | margin-top: 0;
354 | padding-bottom: 0;
355 | padding-left: 0;
356 | padding-right: 0;
357 | padding-top: 0;
358 | margin-bottom: 1.45rem;
359 | list-style-position: outside;
360 | list-style-image: none;
361 | }
362 | dl {
363 | margin-left: 0;
364 | margin-right: 0;
365 | margin-top: 0;
366 | padding-bottom: 0;
367 | padding-left: 0;
368 | padding-right: 0;
369 | padding-top: 0;
370 | margin-bottom: 1.45rem;
371 | }
372 | dd {
373 | margin-left: 0;
374 | margin-right: 0;
375 | margin-top: 0;
376 | padding-bottom: 0;
377 | padding-left: 0;
378 | padding-right: 0;
379 | padding-top: 0;
380 | margin-bottom: 1.45rem;
381 | }
382 | p {
383 | margin-left: 0;
384 | margin-right: 0;
385 | margin-top: 0;
386 | padding-bottom: 0;
387 | padding-left: 0;
388 | padding-right: 0;
389 | padding-top: 0;
390 | margin-bottom: 1.45rem;
391 | }
392 | figure {
393 | margin-left: 0;
394 | margin-right: 0;
395 | margin-top: 0;
396 | padding-bottom: 0;
397 | padding-left: 0;
398 | padding-right: 0;
399 | padding-top: 0;
400 | margin-bottom: 1.45rem;
401 | }
402 | pre {
403 | margin-left: 0;
404 | margin-right: 0;
405 | margin-top: 0;
406 | margin-bottom: 1.45rem;
407 | font-size: 0.85rem;
408 | line-height: 1.42;
409 | background: hsla(0, 0%, 0%, 0.04);
410 | border-radius: 3px;
411 | overflow: auto;
412 | word-wrap: normal;
413 | padding: 1.45rem;
414 | }
415 | table {
416 | margin-left: 0;
417 | margin-right: 0;
418 | margin-top: 0;
419 | padding-bottom: 0;
420 | padding-left: 0;
421 | padding-right: 0;
422 | padding-top: 0;
423 | margin-bottom: 1.45rem;
424 | font-size: 1rem;
425 | line-height: 1.45rem;
426 | border-collapse: collapse;
427 | width: 100%;
428 | }
429 | fieldset {
430 | margin-left: 0;
431 | margin-right: 0;
432 | margin-top: 0;
433 | padding-bottom: 0;
434 | padding-left: 0;
435 | padding-right: 0;
436 | padding-top: 0;
437 | margin-bottom: 1.45rem;
438 | }
439 | blockquote {
440 | margin-left: 1.45rem;
441 | margin-right: 1.45rem;
442 | margin-top: 0;
443 | padding-bottom: 0;
444 | padding-left: 0;
445 | padding-right: 0;
446 | padding-top: 0;
447 | margin-bottom: 1.45rem;
448 | }
449 | form {
450 | margin-left: 0;
451 | margin-right: 0;
452 | margin-top: 0;
453 | padding-bottom: 0;
454 | padding-left: 0;
455 | padding-right: 0;
456 | padding-top: 0;
457 | margin-bottom: 1.45rem;
458 | }
459 | noscript {
460 | margin-left: 0;
461 | margin-right: 0;
462 | margin-top: 0;
463 | padding-bottom: 0;
464 | padding-left: 0;
465 | padding-right: 0;
466 | padding-top: 0;
467 | margin-bottom: 1.45rem;
468 | }
469 | iframe {
470 | margin-left: 0;
471 | margin-right: 0;
472 | margin-top: 0;
473 | padding-bottom: 0;
474 | padding-left: 0;
475 | padding-right: 0;
476 | padding-top: 0;
477 | margin-bottom: 1.45rem;
478 | }
479 | hr {
480 | margin-left: 0;
481 | margin-right: 0;
482 | margin-top: 0;
483 | padding-bottom: 0;
484 | padding-left: 0;
485 | padding-right: 0;
486 | padding-top: 0;
487 | margin-bottom: calc(1.45rem - 1px);
488 | background: hsla(0, 0%, 0%, 0.2);
489 | border: none;
490 | height: 1px;
491 | }
492 | address {
493 | margin-left: 0;
494 | margin-right: 0;
495 | margin-top: 0;
496 | padding-bottom: 0;
497 | padding-left: 0;
498 | padding-right: 0;
499 | padding-top: 0;
500 | margin-bottom: 1.45rem;
501 | }
502 | b {
503 | font-weight: bold;
504 | }
505 | strong {
506 | font-weight: bold;
507 | }
508 | dt {
509 | font-weight: bold;
510 | }
511 | th {
512 | font-weight: bold;
513 | }
514 | li {
515 | margin-bottom: calc(1.45rem / 2);
516 | }
517 | ol li {
518 | padding-left: 0;
519 | }
520 | ul li {
521 | padding-left: 0;
522 | }
523 | li > ol {
524 | margin-left: 1.45rem;
525 | margin-bottom: calc(1.45rem / 2);
526 | margin-top: calc(1.45rem / 2);
527 | }
528 | li > ul {
529 | margin-left: 1.45rem;
530 | margin-bottom: calc(1.45rem / 2);
531 | margin-top: calc(1.45rem / 2);
532 | }
533 | blockquote *:last-child {
534 | margin-bottom: 0;
535 | }
536 | li *:last-child {
537 | margin-bottom: 0;
538 | }
539 | p *:last-child {
540 | margin-bottom: 0;
541 | }
542 | li > p {
543 | margin-bottom: calc(1.45rem / 2);
544 | }
545 | code {
546 | font-size: 0.85rem;
547 | line-height: 1.45rem;
548 | }
549 | kbd {
550 | font-size: 0.85rem;
551 | line-height: 1.45rem;
552 | }
553 | samp {
554 | font-size: 0.85rem;
555 | line-height: 1.45rem;
556 | }
557 | abbr {
558 | border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);
559 | cursor: help;
560 | }
561 | acronym {
562 | border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);
563 | cursor: help;
564 | }
565 | abbr[title] {
566 | border-bottom: 1px dotted hsla(0, 0%, 0%, 0.5);
567 | cursor: help;
568 | text-decoration: none;
569 | }
570 | thead {
571 | text-align: left;
572 | }
573 | td,
574 | th {
575 | text-align: left;
576 | border-bottom: 1px solid hsla(0, 0%, 0%, 0.12);
577 | font-feature-settings: "tnum";
578 | -moz-font-feature-settings: "tnum";
579 | -ms-font-feature-settings: "tnum";
580 | -webkit-font-feature-settings: "tnum";
581 | padding-left: 0.96667rem;
582 | padding-right: 0.96667rem;
583 | padding-top: 0.725rem;
584 | padding-bottom: calc(0.725rem - 1px);
585 | }
586 | th:first-child,
587 | td:first-child {
588 | padding-left: 0;
589 | }
590 | th:last-child,
591 | td:last-child {
592 | padding-right: 0;
593 | }
594 | tt,
595 | code {
596 | background-color: hsla(0, 0%, 0%, 0.04);
597 | border-radius: 3px;
598 | font-family: "SFMono-Regular", Consolas, "Roboto Mono", "Droid Sans Mono",
599 | "Liberation Mono", Menlo, Courier, monospace;
600 | padding: 0;
601 | padding-top: 0.2em;
602 | padding-bottom: 0.2em;
603 | }
604 | pre code {
605 | background: none;
606 | line-height: 1.42;
607 | }
608 | code:before,
609 | code:after,
610 | tt:before,
611 | tt:after {
612 | letter-spacing: -0.2em;
613 | content: " ";
614 | }
615 | pre code:before,
616 | pre code:after,
617 | pre tt:before,
618 | pre tt:after {
619 | content: "";
620 | }
621 | @media only screen and (max-width: 480px) {
622 | html {
623 | font-size: 100%;
624 | }
625 | }
626 |
627 | :root {
628 | --bg-color: black;
629 | --text-color: white;
630 | --banner-bg-color: black;
631 | --banner-text-color: white;
632 | --fork-color: #5000ca;
633 | }
634 |
635 | .dark-theme {
636 | --bg-color: black;
637 | --text-color: white;
638 | --banner-bg-color: black;
639 | --banner-text-color: white;
640 | }
641 | .light-theme {
642 | --bg-color: white;
643 | --text-color: black;
644 | --banner-bg-color: black;
645 | --banner-text-color: white;
646 | }
647 |
648 | .banner-sec {
649 | background-color: var(--banner-bg-color);
650 | color: var(--banner-text-color);
651 | margin-bottom: 1.5em;
652 | }
653 |
654 | .banner-sec .banner-text {
655 | margin: 2em 0 0;
656 | }
657 |
658 | .footer-sec {
659 | background-color: var(--banner-bg-color);
660 | color: var(--banner-text-color);
661 | padding: 1em 0;
662 | }
663 |
664 | .footer-sec a {
665 | color: white;
666 | }
667 |
668 | .row-option {
669 | margin: 2em 0;
670 | }
671 |
672 | .row-option label {
673 | font-weight: bold;
674 | display: block;
675 | margin-bottom: 0.5em;
676 | }
677 |
678 | .row-option input {
679 | padding: 0.5em;
680 | font-size: 1em;
681 | border-radius: 4px;
682 | border: 1px solid #ccc;
683 | }
684 |
685 | .row-option button {
686 | padding: 0.5em 1em;
687 | margin-left: 1em;
688 | font-size: 1em;
689 | border-radius: 4px;
690 | background-color: #5000ca;
691 | border: 1px solid;
692 | color: white;
693 | }
694 |
--------------------------------------------------------------------------------
/website/src/components/layout.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Layout component that queries for data
3 | * with Gatsby's useStaticQuery component
4 | *
5 | * See: https://www.gatsbyjs.org/docs/use-static-query/
6 | */
7 |
8 | import React from "react"
9 | import PropTypes from "prop-types"
10 | import "./layout.css"
11 | import "./index.css"
12 |
13 | const Layout = ({ children }) => {
14 | return (
15 | <>
16 |
24 | {children}
25 |
26 | >
27 | )
28 | }
29 |
30 | Layout.propTypes = {
31 | children: PropTypes.node.isRequired,
32 | }
33 |
34 | export default Layout
35 |
--------------------------------------------------------------------------------
/website/src/components/seo.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SEO component that queries for data with
3 | * Gatsby's useStaticQuery React hook
4 | *
5 | * See: https://www.gatsbyjs.org/docs/use-static-query/
6 | */
7 |
8 | import React from "react"
9 | import PropTypes from "prop-types"
10 | import Helmet from "react-helmet"
11 | import { useStaticQuery, graphql } from "gatsby"
12 |
13 | function SEO({ description, lang, meta, title }) {
14 | const { site } = useStaticQuery(
15 | graphql`
16 | query {
17 | site {
18 | siteMetadata {
19 | title
20 | description
21 | author
22 | }
23 | }
24 | }
25 | `
26 | )
27 |
28 | const metaDescription = description || site.siteMetadata.description
29 |
30 | return (
31 |
72 | )
73 | }
74 |
75 | SEO.defaultProps = {
76 | lang: `en`,
77 | meta: [],
78 | description: ``,
79 | }
80 |
81 | SEO.propTypes = {
82 | description: PropTypes.string,
83 | lang: PropTypes.string,
84 | meta: PropTypes.arrayOf(PropTypes.object),
85 | title: PropTypes.string.isRequired,
86 | }
87 |
88 | export default SEO
89 |
--------------------------------------------------------------------------------
/website/src/images/gatsby-astronaut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/website/src/images/gatsby-astronaut.png
--------------------------------------------------------------------------------
/website/src/images/gatsby-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/website/src/images/gatsby-icon.png
--------------------------------------------------------------------------------
/website/src/images/ss_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/website/src/images/ss_1.png
--------------------------------------------------------------------------------
/website/src/images/ss_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/website/src/images/ss_2.png
--------------------------------------------------------------------------------
/website/src/images/ss_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binodswain/react-faq-component/9c899195a5bd132789b8defd07830072e3fa0cd2/website/src/images/ss_3.png
--------------------------------------------------------------------------------
/website/src/pages/demo-more.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from "react"
2 | import Layout from "../components/layout"
3 | import SEO from "../components/seo"
4 | import Gitfork from "../components/githubFork"
5 | import Footer from "../components/footer"
6 | import Faq from "react-faq-component"
7 | import Prism from "prismjs"
8 | import { Fragment } from "react"
9 | import FaqExternal from "../components/faqToggleOption"
10 |
11 | const data = {
12 | title: "FAQ (How it works)",
13 | rows: [
14 | {
15 | title:
16 | "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat Lorem ipsum dolor sit amet, ",
17 | content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
18 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
19 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
20 | Fusce sed commodo purus, at tempus turpis.`,
21 | },
22 | {
23 | title: "Nunc maximus, magna at ultricies elementum",
24 | content:
25 | "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.",
26 | },
27 | {
28 | title: "Can I use html as content",
29 | content: `Yes, here is an example of a link `,
30 | },
31 | {
32 | title: "What is the package version",
33 | content: "v1.0.5",
34 | },
35 | ],
36 | }
37 |
38 | const IndexPage = () => {
39 | useEffect(() => {
40 | // call the highlightAll() function to style our code blocks
41 | Prism.highlightAll()
42 | }, [])
43 |
44 | return (
45 |
46 | {/* */}
58 |
59 |
60 |
61 |
62 | More Demos
63 |
64 | View 1 (with animation):
65 |
66 |
67 | {` `}
74 |
75 |
76 |
83 |
84 | View 2 (with animation, custom icon):
85 |
86 |
87 | {` `}
97 |
98 |
99 |
110 |
111 | View 3 (with different title colors):
112 |
113 |
114 | {` `}
122 |
123 |
124 |
132 |
133 | View 4 (with content padding):
134 |
135 |
136 | {` `}
152 |
153 |
154 |
170 |
171 | View 5 (with custom transition and tabFocus):
172 |
173 | {` `}
182 |
183 |
193 |
194 | View 6 (with external row toggle):
195 |
196 | {`export default function App() {
197 | const [rows, setRowsOption] = useState(null)
198 | const [row, setRow] = useState(0)
199 |
200 | const expand = () => {
201 | rows && rows[row].expand()
202 | }
203 |
204 | const close = () => {
205 | rows && rows[row].close()
206 | }
207 |
208 | return (
209 |
210 |
211 |
212 |
213 | Enter row number:
214 | setRow(e.target.value)}
216 | min="0" max="3" disabled={!rows}
217 | />
218 |
219 | Exapnd row
220 |
221 |
222 |
223 | Close row
224 |
225 |
226 |
227 | );
228 | }
229 |
230 | `}
231 |
232 |
233 |
234 |
235 |
236 |
237 | )
238 | }
239 |
240 | export default IndexPage
241 |
--------------------------------------------------------------------------------
/website/src/pages/index.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from "react"
2 | import { Link } from "gatsby"
3 | import Layout from "../components/layout"
4 | import SEO from "../components/seo"
5 | import Gitfork from "../components/githubFork"
6 | import Faq from "react-faq-component"
7 | import Prism from "prismjs"
8 | import Header from "../components/header"
9 | import Footer from "../components/footer"
10 | import { Fragment } from "react"
11 |
12 | const dataJSON = {
13 | title: "FAQ title",
14 | rows: [
15 | {
16 | title: "Question 1",
17 | content: "Answer 1",
18 | },
19 | {
20 | title: "Question 2",
21 | content: "Answer 2",
22 | },
23 | ],
24 | }
25 |
26 | const data = {
27 | title: "FAQ (How it works)",
28 | rows: [
29 | {
30 | title: "Lorem ipsum dolor sit amet,",
31 | content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed tempor sem. Aenean vel turpis feugiat,
32 | ultricies metus at, consequat velit. Curabitur est nibh, varius in tellus nec, mattis pulvinar metus.
33 | In maximus cursus lorem, nec laoreet velit eleifend vel. Ut aliquet mauris tortor, sed egestas libero interdum vitae.
34 | Fusce sed commodo purus, at tempus turpis.`,
35 | },
36 | {
37 | title: "Nunc maximus, magna at ultricies elementum",
38 | content:
39 | "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam, vitae convallis ex tortor sed dolor.",
40 | },
41 | {
42 | title: "Can I use html as content",
43 | content: `Yes, here is an example of a link `,
44 | },
45 | {
46 | title: "What is the package version",
47 | content: "v1.0.5",
48 | },
49 | ],
50 | }
51 |
52 | const config = {
53 | animate: true,
54 | // arrowIcon: "V",
55 | }
56 |
57 | const htmlcode = `import React, { Component } from 'react';
58 | import Faq from 'react-faq-component';
59 |
60 | const data = {
61 | title: "FAQ (How it works)",
62 | rows: [
63 | {
64 | title: "Lorem ipsum dolor sit amet,",
65 | content: "Lorem ipsum dolor sit amet, consectetur "
66 | },
67 | {
68 | title: "Nunc maximus, magna at ultricies elementum",
69 | content: "Nunc maximus, magna at ultricies elementum, risus turpis vulputate quam."
70 | },
71 | {
72 | title: "Curabitur laoreet, mauris vel blandit fringilla",
73 | content: "Curabitur laoreet, mauris vel blandit fringilla, leo elit rhoncus nunc"
74 | },
75 | {
76 | title: "What is the package version",
77 | content: "v1.0.5"
78 | }]
79 | }
80 |
81 | export default class App extends Component {
82 | render() {
83 | return (
84 |
85 |
86 |
87 | )
88 | }
89 | }
90 | `
91 |
92 | const styles = {
93 | // bgColor: 'white',
94 | titleTextColor: "blue",
95 | rowTitleColor: "blue",
96 | // rowContentColor: 'grey'
97 | }
98 |
99 | const IndexPage = () => {
100 | useEffect(() => {
101 | // call the highlightAll() function to style our code blocks
102 | Prism.highlightAll()
103 | }, [])
104 |
105 | return (
106 |
107 |
108 |
109 |
110 |
111 |
131 |
132 |
133 | Demo
134 |
135 | More demo
136 |
137 |
138 |
139 | Usage
140 | Install the package.
141 |
142 |
143 | npm install --save react-faq-component
144 |
145 |
146 | Import the package.
147 |
148 |
149 | import Faq from 'react-faq-component';
150 |
151 |
152 |
153 | example:
154 |
155 |
156 | {htmlcode}
157 |
158 |
159 |
160 | Data format
161 |
162 | The data passed into react-faq-component is an
163 | object having two keys i.e title (String) and{" "}
164 | rows (array of objects).
165 |
166 |
167 |
168 | {JSON.stringify(dataJSON, null, 4)}
169 |
170 |
171 |
172 |
173 |
174 |
175 | )
176 | }
177 |
178 | export default IndexPage
179 |
--------------------------------------------------------------------------------