Skip to content

Commit

Permalink
remove tooltip from copy button and eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
okauppinen committed Dec 2, 2024
1 parent 693a200 commit 2b1e19e
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions bundles/framework/mydata/view/embedded/SnippetPopup.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Message, Tooltip, CopyField } from 'oskari-ui';
import { Message, CopyField } from 'oskari-ui';
import styled from 'styled-components';
import { SecondaryButton, ButtonContainer, CopyButton } from 'oskari-ui/components/buttons';
import { showPopup } from 'oskari-ui/components/window';
Expand All @@ -16,15 +15,15 @@ const Content = styled.div`
margin: 12px 24px 24px;
`;

const SnippetPopup = ({html, onClose}) => {
const SnippetPopup = ({ html, onClose }) => {
const [highlighted, setHighlighted] = useState(false);

const highlightUrl = () => {
setHighlighted(true);
setTimeout(() => {
setHighlighted(false);
}, 1000);
}
};

return (
<Content>
Expand All @@ -35,16 +34,17 @@ const SnippetPopup = ({html, onClose}) => {
/>
<ButtonContainer>
<SecondaryButton type='cancel' onClick={onClose}/>
<Tooltip title={<Message messageKey={`tabs.publishedmaps.published.copy`} />}>
<CopyButton
value={html}
onClick={() => highlightUrl()}
/>
</Tooltip>
<CopyButton
value={html}
onClick={() => highlightUrl()}/>
</ButtonContainer>
</Content>
);
};
SnippetPopup.propTypes = {
html: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired
};

export const showSnippetPopup = (view, onClose) => {
const title = <Message messageKey="tabs.publishedmaps.getHTML" bundleKey={BUNDLE_NAME} />;
Expand All @@ -68,9 +68,4 @@ export const showSnippetPopup = (view, onClose) => {
</LocaleProvider>
);
return showPopup(title, content, onClose, POPUP_OPTIONS);
}

showSnippetPopup.propTypes = {
view: PropTypes.object,
onClose: PropTypes.func.isRequired
};

0 comments on commit 2b1e19e

Please sign in to comment.