MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / ScrollStackDemo

Function ScrollStackDemo

src/demo/Components/ScrollStackDemo.jsx:30–282  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28};
29
30const ScrollStackDemo = () => {
31 const [key, forceRerender] = useForceRerender();
32 const [isCompleted, setIsCompleted] = useState(false);
33 const { props, updateProp, resetProps, hasChanges } = useComponentProps(DEFAULT_PROPS);
34 const { itemDistance, itemStackDistance, baseScale, rotationAmount, blurAmount, stackPosition } = props;
35
36 const handleRefresh = () => {
37 forceRerender();
38 setIsCompleted(false);
39 };
40
41 const handlePropChange = (propName, value) => {
42 updateProp(propName, value);
43 forceRerender();
44 };
45
46 const handleStackComplete = () => {
47 setIsCompleted(true);
48 };
49
50 const stackPositionOptions = [
51 { value: '10%', label: '10%' },
52 { value: '15%', label: '15%' },
53 { value: '20%', label: '20%' },
54 { value: '25%', label: '25%' },
55 { value: '30%', label: '30%' },
56 { value: '35%', label: '35%' }
57 ];
58
59 const propData = useMemo(
60 () => [
61 {
62 name: 'children',
63 type: 'ReactNode',
64 default: 'required',
65 description: 'The content to be displayed in the scroll stack. Should contain ScrollStackItem components.'
66 },
67 {
68 name: 'className',
69 type: 'string',
70 default: '""',
71 description: 'Additional CSS classes to apply to the scroll stack container.'
72 },
73 {
74 name: 'itemDistance',
75 type: 'number',
76 default: '100',
77 description: 'Distance between stacked items in pixels.'
78 },
79 {
80 name: 'itemScale',
81 type: 'number',
82 default: '0.03',
83 description: 'Scale increment for each stacked item.'
84 },
85 {
86 name: 'itemStackDistance',
87 type: 'number',

Callers

nothing calls this directly

Calls 3

useForceRerenderFunction · 0.85
useComponentPropsFunction · 0.85
handlePropChangeFunction · 0.85

Tested by

no test coverage detected