diff --git a/apps/remix-ide/src/app/tabs/locales/en/solUmlgen.json b/apps/remix-ide/src/app/tabs/locales/en/solUmlgen.json new file mode 100644 index 0000000000..ca63867e93 --- /dev/null +++ b/apps/remix-ide/src/app/tabs/locales/en/solUmlgen.json @@ -0,0 +1,4 @@ +{ + "solUml.pngDownload": "Download as PNG", + "solUml.pdfDownload": "Download as PDF" +} \ No newline at end of file diff --git a/apps/remix-ide/src/app/tabs/locales/zh/solUmlgen.json b/apps/remix-ide/src/app/tabs/locales/zh/solUmlgen.json new file mode 100644 index 0000000000..c5f9d83bc1 --- /dev/null +++ b/apps/remix-ide/src/app/tabs/locales/zh/solUmlgen.json @@ -0,0 +1,4 @@ +{ + "solUml.PngDownload": "sfg", + "solUml.PdfDownload": "sdf" +} \ No newline at end of file diff --git a/libs/remix-ui/solidity-uml-gen/src/lib/components/UmlDownload.tsx b/libs/remix-ui/solidity-uml-gen/src/lib/components/UmlDownload.tsx index 391e899d83..0bd1a46414 100644 --- a/libs/remix-ui/solidity-uml-gen/src/lib/components/UmlDownload.tsx +++ b/libs/remix-ui/solidity-uml-gen/src/lib/components/UmlDownload.tsx @@ -1,5 +1,43 @@ -import React, { Fragment } from 'react' +import { CustomTooltip } from '@remix-ui/helper' +import React, { Fragment, Ref } from 'react' import { Dropdown } from 'react-bootstrap' +import { FormattedMessage } from 'react-intl' + +const _paq = window._paq = window._paq || [] + +export const Markup = React.forwardRef(({ children, onClick, icon, className = '' }: { children: React.ReactNode, + onClick: (e) => void, icon: string, className: string }, ref: Ref) => ( + +)) + +export const UmlCustomMenu = React.forwardRef( + ({ children, style, className, 'aria-labelledby': labeledBy }: { children: React.ReactNode, style?: React.CSSProperties, className: string, 'aria-labelledby'?: string }, ref: Ref) => { + const height = window.innerHeight * 0.6 + return ( +
+
    + { + children + } +
+
+ ) + }, +) export default function UmlDownload() { @@ -11,18 +49,77 @@ export default function UmlDownload() { const downloadAsPdf = () => { // convert serialized svg to pdf and download } + return( - - - + + - - Download as PNG - - Download as PDF + + + +
{ + _paq.push(['trackEvent', 'solUmlgen', 'download', 'downloadAsPng']) + }} + > + { + _paq.push(['trackEvent', 'solUmlgen', 'download', 'downloadAsPng']) + }} + className='far fa-image pl-2' + > + + + Download as PNG + +
+
+
+ + + +
{ + _paq.push(['trackEvent', 'solUmlgen', 'download', 'downloadAsPdf']) + }} + > + { + _paq.push(['trackEvent', 'solUmlgen', 'download', 'downloadAsPdf']) + }} + className='far fa-file-pdf pl-2' + > + + + Download as PDF + +
+
+
) -} \ No newline at end of file +} + diff --git a/libs/remix-ui/solidity-uml-gen/src/lib/css/solidity-uml-gen.css b/libs/remix-ui/solidity-uml-gen/src/lib/css/solidity-uml-gen.css index bc9cf7fd0e..b746bce0b8 100644 --- a/libs/remix-ui/solidity-uml-gen/src/lib/css/solidity-uml-gen.css +++ b/libs/remix-ui/solidity-uml-gen/src/lib/css/solidity-uml-gen.css @@ -6,4 +6,27 @@ border-width: 1px; border-style: solid; border-color: var(--info); +} + +#solUmlMenuDropdown > div > ul > a:hover { + background-color: var(--secondary); + border-radius: 2px; + color: var(--text) +} + +.custom-dropdown-items { + padding: 0.25rem 0.25rem; + border-radius: .25rem; + background: var(--custom-select); +} + +.custom-dropdown-items a { + border-radius: .25rem; + text-transform: none; + text-decoration: none; + font-weight: normal; + font-size: 0.875rem; + padding: 0.25rem 0.25rem; + width: auto; + color: var(--text); } \ No newline at end of file