UNPKG

chromogen

Version:

simple, interaction-driven Jest test generator for Recoil and React Hooks apps

119 lines (118 loc) 4.33 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.downloadArrow = void 0; const react_1 = __importStar(require("react")); const Icons_1 = require("../Icons"); const downloadButton = { font: `-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen", "Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue", sans-serif`, color: 'rgba(243, 246, 248, 0.7)', backgroundColor: 'rgb(243, 246, 248, 0.03)', height: '32px', border: '1px solid rgba(243, 246, 248, 0.05)', borderRadius: '6px', display: 'flex', flexDirection: 'row', alignItems: 'center', padding: '6px', gap: '4px', }; const downloadHover = { font: `-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen", "Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue", sans-serif`, color: 'rgba(243, 246, 248, 0.7)', backgroundColor: 'rgb(243, 246, 248, 0.1)', height: '32px', border: '1px solid rgba(243, 246, 248, 0.05)', borderRadius: '6px', display: 'flex', flexDirection: 'row', alignItems: 'center', padding: '6px', gap: '4px', }; const downloadTitleContainer = { display: 'flex', alignItems: 'center', gap: '6px', }; const downloadIconBox = { height: '20px', width: '20px', display: 'flex', alignItems: 'center', justifyContent: 'center', }; const downloadTitleText = { fontSize: '12px', fontWeight: 500, lineHeight: '16px', color: 'rgba(243, 246, 248, 0.7)', marginRight: '12px', }; const downloadLine = { width: '1px', height: '20px', background: 'rgba(243, 246, 248, 0.05)', }; exports.downloadArrow = { width: '20px', height: '20px', }; const arrowIcons = (key) => { if (key == 'download') return Icons_1.icon_download; if (key == 'expand') return Icons_1.icon_expand; if (key == 'retract') return Icons_1.icon_retract; if (key == 'copy') return Icons_1.icon_copy; if (key == 'arrow') return Icons_1.icon_arrow; if (key == 'check') return Icons_1.icon_check; else return Icons_1.icon_arrow; }; const ArrowSection = () => { return (react_1.default.createElement(react_1.default.Fragment, null, react_1.default.createElement("div", { style: downloadLine }), react_1.default.createElement("div", { style: exports.downloadArrow }, Icons_1.icon_arrow))); }; const SecondaryButton = ({ value, arrow, icon, handleClick }) => { const [isHover, setIsHover] = (0, react_1.useState)(false); const handleMouseEnter = () => { setIsHover(true); }; const handleMouseLeave = () => { setIsHover(false); }; return (react_1.default.createElement("button", { type: "button", style: isHover ? downloadHover : downloadButton, onClick: handleClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, react_1.default.createElement("div", { style: downloadTitleContainer }, react_1.default.createElement("div", { style: downloadIconBox }, arrowIcons(icon)), value && react_1.default.createElement("div", { style: downloadTitleText }, value)), arrow && react_1.default.createElement(ArrowSection, null))); }; exports.default = SecondaryButton;