web.lib.components.generate-project.extensions-cart.tsx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of code-quarkus Show documentation
Show all versions of code-quarkus Show documentation
Customize a Web Interface to generate Quarkus starter projects.
import React, {useEffect, useState} from 'react';
import './extensions-cart.scss';
import {FaRocket} from 'react-icons/fa';
import {Button, ButtonGroup, Dropdown} from 'react-bootstrap';
import DropdownToggle from 'react-bootstrap/DropdownToggle';
import {ExtensionEntry, TagEntry} from '../extensions-picker/extensions-picker';
import {useAnalytics} from '../../core/analytics';
import {InputProps} from '../../core/types';
import _ from 'lodash';
import classNames from 'classnames';
import {SelectedExtensions} from "../extensions-picker/selected-extensions";
import {Platform} from "../api/model";
export interface ExtensionsCartValue {
extensions: ExtensionEntry[];
}
export interface ExtensionsCartProps extends InputProps {
platform: Platform;
tagsDef: TagEntry[];
}
export function ExtensionsCart(props: ExtensionsCartProps) {
const [isOpen, setIsOpen] = useState(false);
const [openedFromChange, setOpenedFromChange] = useState(false);
const analytics = useAnalytics();
function onMouseEnterFn(e) {
onToggleFn(true);
}
function onMouseLeaveFn(e) {
onToggleFn(false);
}
function onToggleFn(open: boolean) {
setIsOpen(open);
setOpenedFromChange(false);
}
function onRemove(id: string, type: string) {
props.onChange({extensions: _.filter(props.value.extensions, e => e.id !== id && id !== '*')});
analytics.event('Unselect extension', {extension: id, type, element: 'extension-cart'});
}
return (
{props.value.extensions.length}
);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy