Skip to content

Commit

Permalink
Merge pull request #1346 from kubeshop/olelensmar/fix/new-resource-to…
Browse files Browse the repository at this point in the history
…oltips

fix: added tooltips to New Resource buttons
  • Loading branch information
olensmar authored Feb 13, 2022
2 parents c696a38 + 7491004 commit 625fe93
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
26 changes: 14 additions & 12 deletions src/components/organisms/NavigatorPane/NavigatorPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {FilterOutlined, PlusOutlined} from '@ant-design/icons';
import styled from 'styled-components';

import {NAVIGATOR_HEIGHT_OFFSET, ROOT_FILE_ENTRY} from '@constants/constants';
import {QuickFilterTooltip} from '@constants/tooltips';
import {NewResourceTooltip, QuickFilterTooltip} from '@constants/tooltips';

import {ResourceFilterType} from '@models/appstate';

Expand Down Expand Up @@ -120,17 +120,19 @@ const NavPane: React.FC = () => {
</div>
</MonoPaneTitle>
<S.TitleBarRightButtons>
<S.PlusButton
id="create-resource-button"
$disabled={!isFolderOpen || isInPreviewMode}
$highlighted={highlightedItems.createResource}
className={highlightedItems.createResource ? 'animated-highlight' : ''}
disabled={!isFolderOpen || isInPreviewMode}
icon={<PlusOutlined />}
size="small"
type="link"
onClick={onClickNewResource}
/>
<Tooltip title={NewResourceTooltip}>
<S.PlusButton
id="create-resource-button"
$disabled={!isFolderOpen || isInPreviewMode}
$highlighted={highlightedItems.createResource}
className={highlightedItems.createResource ? 'animated-highlight' : ''}
disabled={!isFolderOpen || isInPreviewMode}
icon={<PlusOutlined />}
size="small"
type="link"
onClick={onClickNewResource}
/>
</Tooltip>
<Tooltip title={QuickFilterTooltip}>
<Badge count={appliedFilters.length} size="small" offset={[-2, 2]} color={Colors.greenOkay}>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ const NewResourceWizard = () => {

return (
<Modal
title="Add New Resource"
title="Create Resource"
visible={newResourceWizardState.isOpen}
onOk={onOk}
onCancel={onCancel}
Expand Down
1 change: 1 addition & 0 deletions src/constants/tooltips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ export const NewEmptyProjectTooltip = 'New Empty Project';
export const SearchProjectTooltip = 'Search for project by name or path';
export const PluginDrawerTooltip = 'Open Plugins Manager';
export const QuickFilterTooltip = `Filter results – Hint: quick-filter using ${KEY_CTRL_CMD} + P`;
export const NewResourceTooltip = `Create new resource (${KEY_CTRL_CMD} + N)`;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {useCallback, useMemo} from 'react';

import {Button} from 'antd';
import {Button, Tooltip} from 'antd';

import {PlusOutlined} from '@ant-design/icons';

Expand Down Expand Up @@ -65,14 +65,16 @@ const ResourceKindSectionSuffix: React.FC<SectionCustomComponentProps> = props =
return (
<SuffixContainer>
<ButtonContainer>
<Button
icon={<PlusOutlined />}
type="link"
onClick={createResource}
size="small"
disabled={isInPreviewMode}
style={{color: sectionInstance.isSelected && isSectionCollapsed ? Colors.blackPure : undefined}}
/>
<Tooltip title={`Create a new ${resourceKind}`}>
<Button
icon={<PlusOutlined />}
type="link"
onClick={createResource}
size="small"
disabled={isInPreviewMode}
style={{color: sectionInstance.isSelected && isSectionCollapsed ? Colors.blackPure : undefined}}
/>
</Tooltip>
</ButtonContainer>
</SuffixContainer>
);
Expand Down

0 comments on commit 625fe93

Please sign in to comment.