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

Make project template workspace icon tab navigable #57908

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 19 additions & 23 deletions apps/src/templates/ProjectTemplateWorkspaceIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import React from 'react';
import ReactTooltip from 'react-tooltip';
import _ from 'lodash';
import PropTypes from 'prop-types';
import moduleStyles from './project-template-workspace-icon.module.scss';
import classNames from 'classnames';

var msg = require('@cdo/locale');

const IMAGE_BASE_URL = '/blockly/media/';
Expand All @@ -18,43 +21,36 @@ export default class ProjectTemplateWorkspaceIcon extends React.Component {

render() {
return (
<div style={styles.container}>
<img
style={styles.projectTemplateIcon}
className="projectTemplateWorkspaceIcon"
src={IMAGE_BASE_URL + 'connect.svg'}
<div className={moduleStyles.container}>
<button
type="button"
data-tip
data-for={this.tooltipId}
aria-describedby={this.tooltipId}
alt={msg.workspaceProjectTemplateLevel()}
/>
data-event="mouseenter mouseleave click"
className={moduleStyles.projectTemplateButton}
>
<img
className={classNames(
'projectTemplateWorkspaceIcon',
moduleStyles.projectTemplateIcon
)}
src={IMAGE_BASE_URL + 'connect.svg'}
alt={msg.workspaceProjectTemplateLevel()}
/>
</button>
<ReactTooltip
id={this.tooltipId}
role="tooltip"
wrapper="div"
effect="solid"
place={this.props.tooltipPlace}
>
<div style={styles.tooltip}>
<div className={moduleStyles.tooltip}>
{msg.workspaceProjectTemplateLevel()}
</div>
</ReactTooltip>
</div>
);
}
}

const styles = {
container: {
display: 'inline-block',
},
tooltip: {
maxWidth: 200,
lineHeight: '20px',
whiteSpace: 'normal',
},
projectTemplateIcon: {
marginRight: 5,
marginTop: -1,
},
};
24 changes: 24 additions & 0 deletions apps/src/templates/project-template-workspace-icon.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@import '@cdo/apps/mixins.scss';
@import 'color.scss';

.container {
display: inline-block;
}

.tooltip {
max-width: 200px;
line-height: 20px;
white-space: normal;
}

.projectTemplateIcon {
padding-top: 9px;
padding-bottom: 10px;
opacity: 1;
}

.projectTemplateButton {
@include remove-button-styles;
margin-right: 5px;
margin-bottom: -1px;
}