react-image-accordion 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -99
- package/dist/index.css +1 -0
- package/dist/index.es.css +1 -0
- package/dist/index.es.js +118 -123
- package/dist/index.js +118 -123
- package/package.json +14 -9
- package/.babelrc.json +0 -15
- package/.storybook/main.js +0 -11
- package/.storybook/preview.js +0 -9
- package/rollup.config.js +0 -39
- package/src/.prettierrc +0 -1
- package/src/components/Accordion/App.css +0 -222
- package/src/components/Accordion/React-image-accordion.js +0 -22
- package/src/components/Accordion/UseImageAccordion.js +0 -131
- package/src/components/Accordion/index.js +0 -2
- package/src/index.js +0 -2
- package/src/stories/MockAccordion.json +0 -66
- package/src/stories/UseImageAccordion.stories.js +0 -20
- package/src/stories/sprite.svg +0 -49
package/dist/index.js
CHANGED
|
@@ -8,48 +8,70 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
function _iterableToArrayLimit(arr, i) {
|
|
12
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
13
|
+
if (null != _i) {
|
|
14
|
+
var _s,
|
|
15
|
+
_e,
|
|
16
|
+
_x,
|
|
17
|
+
_r,
|
|
18
|
+
_arr = [],
|
|
19
|
+
_n = !0,
|
|
20
|
+
_d = !1;
|
|
21
|
+
try {
|
|
22
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
23
|
+
if (Object(_i) !== _i) return;
|
|
24
|
+
_n = !1;
|
|
25
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
_d = !0, _e = err;
|
|
28
|
+
} finally {
|
|
29
|
+
try {
|
|
30
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
31
|
+
} finally {
|
|
32
|
+
if (_d) throw _e;
|
|
33
|
+
}
|
|
26
34
|
}
|
|
27
|
-
|
|
28
|
-
head.appendChild(style);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (style.styleSheet) {
|
|
32
|
-
style.styleSheet.cssText = css;
|
|
33
|
-
} else {
|
|
34
|
-
style.appendChild(document.createTextNode(css));
|
|
35
|
+
return _arr;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
38
|
+
function _slicedToArray(arr, i) {
|
|
39
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
40
|
+
}
|
|
41
|
+
function _arrayWithHoles(arr) {
|
|
42
|
+
if (Array.isArray(arr)) return arr;
|
|
43
|
+
}
|
|
44
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
45
|
+
if (!o) return;
|
|
46
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
47
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
48
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
49
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
50
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
51
|
+
}
|
|
52
|
+
function _arrayLikeToArray(arr, len) {
|
|
53
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
54
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
55
|
+
return arr2;
|
|
56
|
+
}
|
|
57
|
+
function _nonIterableRest() {
|
|
58
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
59
|
+
}
|
|
37
60
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const ContentSizeFont = ContentSize || [];
|
|
61
|
+
function UseImageAccordion(_ref) {
|
|
62
|
+
var accordionData = _ref.accordionData,
|
|
63
|
+
AccordionWidth = _ref.AccordionWidth,
|
|
64
|
+
AccordionHeight = _ref.AccordionHeight,
|
|
65
|
+
ContentSize = _ref.ContentSize,
|
|
66
|
+
_onClick = _ref.onClick,
|
|
67
|
+
ShowButton = _ref.ShowButton;
|
|
68
|
+
var _useState = React.useState(null),
|
|
69
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
70
|
+
activePanel = _useState2[0],
|
|
71
|
+
setActivePanel = _useState2[1];
|
|
72
|
+
var ContentSizeFont = ContentSize || [];
|
|
51
73
|
function toggleAccordion(panelToActivate) {
|
|
52
|
-
setActivePanel(prevPanel
|
|
74
|
+
setActivePanel(function (prevPanel) {
|
|
53
75
|
if (prevPanel === panelToActivate) {
|
|
54
76
|
return prevPanel;
|
|
55
77
|
} else {
|
|
@@ -57,39 +79,9 @@ function UseImageAccordion({
|
|
|
57
79
|
}
|
|
58
80
|
});
|
|
59
81
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
height: ${AccordionHeight};
|
|
64
|
-
}
|
|
65
|
-
}`;
|
|
66
|
-
const css = `
|
|
67
|
-
@media (max-width: 480px) {
|
|
68
|
-
.ContentSize {
|
|
69
|
-
font-size: ${ContentSizeFont[0] || "0.65rem"};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
@media (min-width: 481px) and (max-width: 768px) {
|
|
73
|
-
.ContentSize {
|
|
74
|
-
font-size: ${ContentSizeFont[1] || "0.8rem"};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
@media (min-width: 769px) and (max-width: 1024px) {
|
|
78
|
-
.ContentSize {
|
|
79
|
-
font-size: ${ContentSizeFont[2] || "1rem"};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
@media (min-width: 1025px) and (max-width: 1200px) {
|
|
83
|
-
.ContentSize {
|
|
84
|
-
font-size: ${ContentSizeFont[3] || "1.2rem"};
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
@media (min-width: 1201px) {
|
|
88
|
-
.ContentSize {
|
|
89
|
-
font-size: ${ContentSizeFont[4] || "1.5rem"};
|
|
90
|
-
}
|
|
91
|
-
}`;
|
|
92
|
-
React.useEffect(() => {
|
|
82
|
+
var HeightStyle = "\n @media (min-width: 768px) {\n .AccHeight {\n height: ".concat(AccordionHeight, ";\n }\n }");
|
|
83
|
+
var css = "\n @media (max-width: 480px) {\n .ContentSize {\n font-size: ".concat(ContentSizeFont[0] || "0.65rem", ";\n }\n }\n @media (min-width: 481px) and (max-width: 768px) {\n .ContentSize {\n font-size: ").concat(ContentSizeFont[1] || "0.8rem", ";\n }\n }\n @media (min-width: 769px) and (max-width: 1024px) {\n .ContentSize {\n font-size: ").concat(ContentSizeFont[2] || "1rem", ";\n }\n }\n @media (min-width: 1025px) and (max-width: 1200px) {\n .ContentSize {\n font-size: ").concat(ContentSizeFont[3] || "1.2rem", ";\n }\n }\n @media (min-width: 1201px) {\n .ContentSize {\n font-size: ").concat(ContentSizeFont[4] || "1.5rem", ";\n }\n }");
|
|
84
|
+
React.useEffect(function () {
|
|
93
85
|
setActivePanel(accordionData[0].id);
|
|
94
86
|
}, []);
|
|
95
87
|
if (!accordionData) return null;
|
|
@@ -102,61 +94,64 @@ function UseImageAccordion({
|
|
|
102
94
|
scoped: true
|
|
103
95
|
}, HeightStyle), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
104
96
|
className: "accordionImage AccHeight"
|
|
105
|
-
}, accordionData.map(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
97
|
+
}, accordionData.map(function (item) {
|
|
98
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
99
|
+
key: item.id,
|
|
100
|
+
className: "accordion-panel",
|
|
101
|
+
onClick: function onClick() {
|
|
102
|
+
return toggleAccordion(item.id);
|
|
103
|
+
}
|
|
104
|
+
}, /*#__PURE__*/React__default["default"].createElement("h2", {
|
|
105
|
+
id: item.id
|
|
106
|
+
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
107
|
+
type: "button",
|
|
108
|
+
className: "accordion-trigger",
|
|
109
|
+
"aria-controls": "panel1-content",
|
|
110
|
+
"aria-expanded": activePanel === item.id
|
|
111
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
112
|
+
className: "accordion-title",
|
|
113
|
+
id: item.id
|
|
114
|
+
}, item.title), /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
115
|
+
"aria-hidden": "true",
|
|
116
|
+
className: "accordion-icon",
|
|
117
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
118
|
+
}, /*#__PURE__*/React__default["default"].createElement("image", {
|
|
119
|
+
href: item.svg
|
|
120
|
+
})))), /*#__PURE__*/React__default["default"].createElement("style", {
|
|
121
|
+
scoped: true
|
|
122
|
+
}, css), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
123
|
+
className: "accordion-content ContentSize",
|
|
124
|
+
style: {
|
|
125
|
+
height: "calc(".concat(AccordionHeight, " - 5rem)")
|
|
126
|
+
},
|
|
127
|
+
id: item.id,
|
|
128
|
+
"aria-labelledby": item.id,
|
|
129
|
+
"aria-hidden": activePanel !== item.id,
|
|
130
|
+
role: "region"
|
|
131
|
+
}, /*#__PURE__*/React__default["default"].createElement("p", null, item.content), ShowButton && /*#__PURE__*/React__default["default"].createElement("button", {
|
|
132
|
+
className: "accordion-Link",
|
|
133
|
+
onClick: function onClick(e) {
|
|
134
|
+
e.stopPropagation();
|
|
135
|
+
_onClick({
|
|
136
|
+
id: item.id,
|
|
137
|
+
title: item.title
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}, item.title), /*#__PURE__*/React__default["default"].createElement("img", {
|
|
141
|
+
className: "accordion-image",
|
|
142
|
+
src: item.image,
|
|
143
|
+
alt: item.alt
|
|
144
|
+
})));
|
|
145
|
+
}))));
|
|
150
146
|
}
|
|
151
147
|
|
|
152
|
-
|
|
153
|
-
accordionData,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}) => {
|
|
148
|
+
var ReactImageAccordion = function ReactImageAccordion(_ref) {
|
|
149
|
+
var accordionData = _ref.accordionData,
|
|
150
|
+
AccordionWidth = _ref.AccordionWidth,
|
|
151
|
+
AccordionHeight = _ref.AccordionHeight,
|
|
152
|
+
ContentSize = _ref.ContentSize,
|
|
153
|
+
onClick = _ref.onClick,
|
|
154
|
+
ShowButton = _ref.ShowButton;
|
|
160
155
|
return /*#__PURE__*/React__default["default"].createElement(UseImageAccordion, {
|
|
161
156
|
accordionData: accordionData,
|
|
162
157
|
AccordionWidth: AccordionWidth,
|
package/package.json
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-image-accordion",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Accordion component for React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
7
13
|
"scripts": {
|
|
8
|
-
"
|
|
14
|
+
"build": "npm run build-lib",
|
|
15
|
+
"build-lib": "rollup -c",
|
|
9
16
|
"storybook": "storybook dev -p 6006",
|
|
10
|
-
"build-storybook": "storybook build"
|
|
11
|
-
"build-lib": "rollup -c"
|
|
17
|
+
"build-storybook": "storybook build"
|
|
12
18
|
},
|
|
13
19
|
"repository": {
|
|
14
20
|
"type": "git",
|
|
15
|
-
"url": "
|
|
21
|
+
"url": "https://github.com/masoud-naji/Accordion.git"
|
|
16
22
|
},
|
|
17
23
|
"keywords": [
|
|
18
24
|
"react",
|
|
@@ -26,9 +32,9 @@
|
|
|
26
32
|
"author": "Masoud Naji",
|
|
27
33
|
"license": "MIT",
|
|
28
34
|
"bugs": {
|
|
29
|
-
"url": "https://github.com/masoud-naji/Accordion"
|
|
35
|
+
"url": "https://github.com/masoud-naji/Accordion/issues"
|
|
30
36
|
},
|
|
31
|
-
"homepage": "https://github.com/masoud-naji/Accordion",
|
|
37
|
+
"homepage": "https://github.com/masoud-naji/Accordion#readme",
|
|
32
38
|
"devDependencies": {
|
|
33
39
|
"@babel/core": "^7.18.2",
|
|
34
40
|
"@babel/preset-env": "^7.21.4",
|
|
@@ -58,8 +64,7 @@
|
|
|
58
64
|
},
|
|
59
65
|
"dependencies": {
|
|
60
66
|
"@rollup/plugin-terser": "^0.4.1",
|
|
61
|
-
"react-image-accordion": "^1.1.6",
|
|
62
67
|
"rollup-plugin-local-resolve": "^1.0.7",
|
|
63
68
|
"rollup-plugin-terser": "^7.0.2"
|
|
64
69
|
}
|
|
65
|
-
}
|
|
70
|
+
}
|
package/.babelrc.json
DELETED
package/.storybook/main.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"stories": ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
3
|
-
"addons": ["@storybook/addon-links", "@storybook/addon-essentials", "@storybook/addon-interactions", "@storybook/addon-mdx-gfm"],
|
|
4
|
-
"framework": {
|
|
5
|
-
name: "@storybook/react-webpack5",
|
|
6
|
-
options: {}
|
|
7
|
-
},
|
|
8
|
-
docs: {
|
|
9
|
-
autodocs: true
|
|
10
|
-
}
|
|
11
|
-
};
|
package/.storybook/preview.js
DELETED
package/rollup.config.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import babel from 'rollup-plugin-babel';
|
|
2
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
3
|
-
import external from 'rollup-plugin-peer-deps-external';
|
|
4
|
-
import postcss from 'rollup-plugin-postcss';
|
|
5
|
-
import localResolve from 'rollup-plugin-local-resolve';
|
|
6
|
-
// import { terser } from "rollup-plugin-terser";
|
|
7
|
-
|
|
8
|
-
export default [
|
|
9
|
-
{
|
|
10
|
-
input: 'src/index.js',
|
|
11
|
-
output: [
|
|
12
|
-
{
|
|
13
|
-
file: 'dist/index.js',
|
|
14
|
-
format: 'cjs',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
file: 'dist/index.es.js',
|
|
18
|
-
format: 'es',
|
|
19
|
-
exports: 'named',
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
plugins: [
|
|
23
|
-
postcss({
|
|
24
|
-
plugins: []
|
|
25
|
-
}),
|
|
26
|
-
babel({
|
|
27
|
-
exclude: 'node_modules/**',
|
|
28
|
-
presets: ['@babel/preset-react'],
|
|
29
|
-
}),
|
|
30
|
-
external(),
|
|
31
|
-
resolve(),
|
|
32
|
-
localResolve(),
|
|
33
|
-
// terser(),
|
|
34
|
-
],
|
|
35
|
-
watch: {
|
|
36
|
-
include: "src/**",
|
|
37
|
-
},
|
|
38
|
-
}
|
|
39
|
-
];
|
package/src/.prettierrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
*,
|
|
2
|
-
*::before,
|
|
3
|
-
*::after {
|
|
4
|
-
box-sizing: border-box;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
html {
|
|
8
|
-
color-scheme: dark;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
body {
|
|
12
|
-
display: grid;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
align-content: center;
|
|
15
|
-
min-height: 100vh;
|
|
16
|
-
|
|
17
|
-
margin: 0;
|
|
18
|
-
font-family: system-ui;
|
|
19
|
-
font-size: 1.125rem;
|
|
20
|
-
line-height: 1.6;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
img {
|
|
24
|
-
max-width: 100%;
|
|
25
|
-
display: block;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.wrapper {
|
|
29
|
-
/* max-width: 50rem; */
|
|
30
|
-
margin-inline: auto;
|
|
31
|
-
padding-inline: 1rem;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.accordionImage {
|
|
35
|
-
--_button-size: 3rem;
|
|
36
|
-
--_panel-padding: 0.75rem;
|
|
37
|
-
--_panel-gap: 1rem;
|
|
38
|
-
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
gap: 1rem;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@media (min-width: 45em) {
|
|
45
|
-
.accordionImage {
|
|
46
|
-
flex-direction: row;
|
|
47
|
-
height: 30rem;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.accordionImage * {
|
|
52
|
-
margin: 0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.accordion-panel {
|
|
56
|
-
position: relative;
|
|
57
|
-
isolation: isolate;
|
|
58
|
-
flex-basis: calc((var(--_panel-padding) * 2) + var(--_button-size));
|
|
59
|
-
overflow: hidden;
|
|
60
|
-
padding: var(--_panel-padding);
|
|
61
|
-
padding-right: calc(var(--_panel-padding) * 4);
|
|
62
|
-
border-radius: calc(((var(--_panel-padding) * 2) + var(--_button-size)) / 2);
|
|
63
|
-
cursor: pointer;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
67
|
-
.accordion-panel {
|
|
68
|
-
transition: flex-basis 500ms, flex-grow 500ms;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.accordion-panel:nth-child(1) {
|
|
73
|
-
--_panel-color: red;
|
|
74
|
-
}
|
|
75
|
-
.accordion-panel:nth-child(2) {
|
|
76
|
-
--_panel-color: blue;
|
|
77
|
-
}
|
|
78
|
-
.accordion-panel:nth-child(3) {
|
|
79
|
-
--_panel-color: green;
|
|
80
|
-
}
|
|
81
|
-
.accordion-panel:nth-child(4) {
|
|
82
|
-
--_panel-color: yellow;
|
|
83
|
-
}
|
|
84
|
-
.accordion-panel:nth-child(5) {
|
|
85
|
-
--_panel-color: orange;
|
|
86
|
-
}
|
|
87
|
-
.accordion-panel:nth-child(6) {
|
|
88
|
-
--_panel-color: purple;
|
|
89
|
-
}
|
|
90
|
-
.accordion-panel:nth-child(7) {
|
|
91
|
-
--_panel-color: pink;
|
|
92
|
-
}
|
|
93
|
-
.accordion-panel:nth-child(8) {
|
|
94
|
-
--_panel-color: brown;
|
|
95
|
-
}
|
|
96
|
-
.accordion-panel:nth-child(9) {
|
|
97
|
-
--_panel-color: cyan;
|
|
98
|
-
}
|
|
99
|
-
.accordion-panel:nth-child(10) {
|
|
100
|
-
--_panel-color: magenta;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.accordion-panel:has([aria-expanded="true"]) {
|
|
104
|
-
flex-basis: clamp(15rem, 40vh, 20rem);
|
|
105
|
-
flex-grow: 1;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.accordion-trigger {
|
|
109
|
-
outline: 0 !important;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.accordion-panel:focus-within {
|
|
113
|
-
outline: 3px solid var(--_panel-color);
|
|
114
|
-
outline-offset: 4px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.accordion-content > p {
|
|
118
|
-
transform: translateY(2rem);
|
|
119
|
-
opacity: 0;
|
|
120
|
-
margin-left: calc(var(--_button-size) + var(--_panel-gap));
|
|
121
|
-
color: rgb(255, 255, 255) !important;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
125
|
-
.accordion-panel:has([aria-expanded="true"]) .accordion-content > p {
|
|
126
|
-
transition: transform 500ms 500ms, opacity 500ms 500ms;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.accordion-panel:has([aria-expanded="true"]) .accordion-content > p {
|
|
131
|
-
transform: translateY(0);
|
|
132
|
-
opacity: 1;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.accordion-title {
|
|
136
|
-
font-size: 1.5rem;
|
|
137
|
-
font-weight: 700;
|
|
138
|
-
position: relative;
|
|
139
|
-
isolation: isolate;
|
|
140
|
-
display: grid;
|
|
141
|
-
align-items: center;
|
|
142
|
-
color: rgb(255, 255, 255) !important;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.accordion-panel:has([aria-expanded="false"]) .accordion-Link {
|
|
146
|
-
display: none;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
@media (max-width: 44.999em) {
|
|
150
|
-
.accordion-panel {
|
|
151
|
-
width: 100%;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.accordion-trigger {
|
|
155
|
-
width: 100%;
|
|
156
|
-
height: var(--_button-size);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.accordion-title {
|
|
160
|
-
font-size: small;
|
|
161
|
-
width: 100%;
|
|
162
|
-
text-align: left;
|
|
163
|
-
}
|
|
164
|
-
.accordion-title::after {
|
|
165
|
-
content: "";
|
|
166
|
-
position: absolute;
|
|
167
|
-
|
|
168
|
-
left: calc((var(--_panel-gap) + var(--_button-size)) * -1);
|
|
169
|
-
width: calc(100% + (var(--_button-size) * 2));
|
|
170
|
-
height: var(--_button-size);
|
|
171
|
-
background: hsl(0 0% 0% /0.55);
|
|
172
|
-
z-index: -1;
|
|
173
|
-
border-radius: 100vw;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.accordion-Link {
|
|
178
|
-
all: revert;
|
|
179
|
-
display: block;
|
|
180
|
-
position: absolute;
|
|
181
|
-
left: -0.1rem;
|
|
182
|
-
bottom: 0;
|
|
183
|
-
margin: 0.75rem;
|
|
184
|
-
width: 10rem;
|
|
185
|
-
height: var(--_button-size);
|
|
186
|
-
background: hsl(0 0% 0% /0.55);
|
|
187
|
-
border-radius: 100vw;
|
|
188
|
-
padding: 0.75rem;
|
|
189
|
-
font-weight: bolder;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.accordion-image {
|
|
193
|
-
position: absolute;
|
|
194
|
-
inset: 0;
|
|
195
|
-
width: 100%;
|
|
196
|
-
height: 100%;
|
|
197
|
-
object-fit: cover;
|
|
198
|
-
z-index: -1;
|
|
199
|
-
transition: filer 500ms;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.accordion-panel:has([aria-expanded="true"]) .accordion-image {
|
|
203
|
-
filter: brightness(0.5);
|
|
204
|
-
}
|
|
205
|
-
.accordion-trigger {
|
|
206
|
-
display: flex;
|
|
207
|
-
align-items: center;
|
|
208
|
-
flex-direction: row-reverse;
|
|
209
|
-
gap: var(--_panel-gap);
|
|
210
|
-
background: transparent;
|
|
211
|
-
border: 0;
|
|
212
|
-
padding: 0;
|
|
213
|
-
}
|
|
214
|
-
.accordion-icon {
|
|
215
|
-
fill: var(--_panel-color);
|
|
216
|
-
background: hsl(0 0% 0% /0.55);
|
|
217
|
-
width: var(--_button-size);
|
|
218
|
-
aspect-ratio: 1/1;
|
|
219
|
-
padding: 0.75rem;
|
|
220
|
-
border-radius: 50%;
|
|
221
|
-
z-index: 10;
|
|
222
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import UseImageAccordion from "./UseImageAccordion";
|
|
3
|
-
|
|
4
|
-
export const ReactImageAccordion = ({
|
|
5
|
-
accordionData,
|
|
6
|
-
AccordionWidth,
|
|
7
|
-
AccordionHeight,
|
|
8
|
-
ContentSize,
|
|
9
|
-
onClick,
|
|
10
|
-
ShowButton,
|
|
11
|
-
}) => {
|
|
12
|
-
return (
|
|
13
|
-
<UseImageAccordion
|
|
14
|
-
accordionData={accordionData}
|
|
15
|
-
AccordionWidth={AccordionWidth}
|
|
16
|
-
AccordionHeight={AccordionHeight}
|
|
17
|
-
ContentSize={ContentSize}
|
|
18
|
-
onClick={onClick}
|
|
19
|
-
ShowButton={ShowButton}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
};
|