46 lines
1.7 KiB
React
46 lines
1.7 KiB
React
/*
|
|
Copyright (C) 2025 QuantumNous
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as
|
|
published by the Free Software Foundation, either version 3 of the
|
|
License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
*/
|
|
|
|
import { ChevronDown as ActionChevronDown } from '@/components/common/icons/ActionIcons';
|
|
import React from 'react';
|
|
import './collapsible-panel.css';
|
|
|
|
const CollapsibleHeader = ({ icon, title, isOpen, onToggle, extra }) => (
|
|
<button
|
|
type='button'
|
|
aria-expanded={isOpen}
|
|
className='app-action-button w-full text-left flex items-center justify-between gap-2 cursor-pointer select-none px-5 py-4 bg-white dark:bg-gray-800 rounded-xl shadow-sm hover:shadow-md transition-all border border-gray-100 dark:border-gray-700'
|
|
onClick={onToggle}
|
|
>
|
|
<span className='flex items-center gap-2 min-w-0 flex-wrap'>
|
|
<span className='text-brand flex-shrink-0'>{icon}</span>
|
|
<span className='font-semibold text-gray-800 dark:text-gray-100'>
|
|
{title}
|
|
</span>
|
|
{extra}
|
|
</span>
|
|
<ActionChevronDown
|
|
aria-hidden='true'
|
|
className={`w-5 h-5 flex-shrink-0 text-gray-400 transition-transform duration-300 ${isOpen ? 'rotate-180' : ''}`}
|
|
/>
|
|
</button>
|
|
);
|
|
|
|
export default CollapsibleHeader;
|