Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implementation of links to tutorials #548

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { useEffect, useMemo, memo } from 'react';
import PropTypes from 'prop-types';
import { DragSource } from 'react-dnd';
import { getEmptyImage } from 'react-dnd-html5-backend';
import { LinkOutlined } from '@ant-design/icons';


import { DragIndicatorComponent } from 'assets';

Expand All @@ -11,6 +13,7 @@ const MenuItem = ({
connectDragPreview,
children,
disabled,
tutorialUrl,
}) => {
const opacity = useMemo(() => (isDragging ? 0.6 : 1), [isDragging]);

Expand Down Expand Up @@ -40,6 +43,13 @@ const MenuItem = ({
</div>

<div className='draggable-item-content-text'>{children}</div>

{tutorialUrl &&
<div className='link-item-content-icon'>
<a className='icon-url' href={tutorialUrl} target='_blank' rel='noreferrer'> <LinkOutlined /> </a>
</div>
}

</div>
);
};
Expand All @@ -50,6 +60,7 @@ MenuItem.propTypes = {
connectDragPreview: PropTypes.any,
children: PropTypes.node,
disabled: PropTypes.bool,
tutorialUrl: PropTypes.string,
};

const DraggableItem = DragSource(
Expand Down Expand Up @@ -88,6 +99,11 @@ DraggableItem.propTypes = {
name: PropTypes.string.isRequired,
icon: PropTypes.node.isRequired,
handleSelect: PropTypes.func.isRequired,
tutorialUrl: PropTypes.string,
};

DraggableItem.defaultProps = {
tutorialUrl: ''
}

export default memo(DraggableItem);
1 change: 1 addition & 0 deletions src/pages/Experiments/TasksMenuBlock/TasksMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const TasksMenu = ({
disabled={disabled}
taskType={taskType}
handleSelect={handleSelect}
tutorialUrl= {'https://google.com'}
>
{renderTooltip(name, description, uuid, title)}
</DraggableItem>
Expand Down
8 changes: 8 additions & 0 deletions src/pages/Experiments/TasksMenuBlock/TasksMenu/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@

padding-left: 24px !important;

.icon-url {
position: relative;
}
.link-item-content-icon {
padding-left: 24px;
margin-left: auto;
}

&:active {
background-color: transparent;
}
Expand Down