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

(VADC-293): Refactor use of inline SVG to use SVG utils for Chart Icons in GWAS #1555

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
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
40 changes: 34 additions & 6 deletions src/Analysis/AtlasDataDictionary/AtlasDataDictionary.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,26 @@
margin-top: 4px;
}

.atlas-data-dictionary-container .table-column-sorter-down svg path,
.atlas-data-dictionary-container .table-column-sorter-up svg path {
fill: #ccc;
.atlas-data-dictionary-container .table-column-sorter-down,
.atlas-data-dictionary-container .table-column-sorter-up {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
}

.atlas-data-dictionary-container .table-column-sorter-down {
border-top: 5px solid #ccc;
}
.atlas-data-dictionary-container .table-column-sorter-down.active {
border-top-color: #1890ff;
}

.atlas-data-dictionary-container .table-column-sorter-down.active svg path,
.atlas-data-dictionary-container .table-column-sorter-up.active svg path {
fill: #1890ff;
.atlas-data-dictionary-container .table-column-sorter-up {
border-bottom: 5px solid #ccc;
}
.atlas-data-dictionary-container .table-column-sorter-up.active {
border-bottom-color: #1890ff;
}

/* Expandable rows */
Expand Down Expand Up @@ -161,6 +173,22 @@
background: none;
}

.arrow-icon {
display: block;
width: 9px;
height: 9px;
margin: 5px;
border-top: 2px solid #2e77b8;
border-left: 2px solid #2e77b8;
}

.arrow-icon-right {
transform: rotate(135deg);
}
.arrow-icon-down {
transform: rotate(225deg);
}

.atlas-data-dictionary-container .search-highlight,
table > tbody > tr > td.search-highlight:last-of-type {
background: #fcefe4;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import { ISortConfig } from '../../Interfaces/Interfaces';
import CaretUp from '../Icons/CaretUp';
import CaretDown from '../Icons/CaretDown';

interface IHeaderProps {
handleSort: Function;
Expand Down Expand Up @@ -47,18 +45,14 @@ const Header = ({
className={`table-column-sorter-up ${
getSortDirectionForCurrentColumn() === 'ascending' && 'active'
}`}
>
<CaretUp />
</span>
/>
<span
role='presentation'
aria-label='caret-down'
className={`table-column-sorter-down ${
getSortDirectionForCurrentColumn() === 'descending' && 'active'
}`}
>
<CaretDown />
</span>
/>
</span>
</div>
</th>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import {
Grid,
Space,
} from '@mantine/core';
import ManageColumnsIcon from '../Icons/ManageColumnsIcon';
import RestoreIcon from '../Icons/RestoreIcon';
import HolderIcon from '../Icons/HolderIcon';
import { IColumnManagementData } from '../../Interfaces/Interfaces';
import './ManageColumns.css';
import ColumnsItems from '../../Utils/ColumnItems';
import IconComponent from '../../../../../components/Icon';
import dictIcons from '../../../../../img/icons/index';

interface IManageColumns {
handleTableChange: Function;
Expand Down Expand Up @@ -65,7 +64,7 @@ const ManageColumns = ({
<Popover opened={opened} onChange={setOpened}>
<Popover.Target>
<Button
leftIcon={<ManageColumnsIcon />}
leftIcon={<IconComponent iconName='gwas-manageColumnsIcon' dictIcons={dictIcons} height='1em' />}
onClick={() => setOpened(!opened)}
variant='white'
size='compact-md'
Expand All @@ -84,7 +83,7 @@ const ManageColumns = ({
>
<Grid align='flex-start'>
<Grid.Col span={iconSpanSize}>
<RestoreIcon />
<IconComponent iconName='gwas-restoreIcon' dictIcons={dictIcons} height='1em' />
</Grid.Col>
<Grid.Col span={columnManagementResetButtonSpanSize} className={'column-label'}>
Restore Defaults
Expand All @@ -104,7 +103,7 @@ const ManageColumns = ({
>
<Grid align='flex-start'>
<Grid.Col span={iconSpanSize}>
<HolderIcon />
<IconComponent iconName='gwas-holderIcon' dictIcons={dictIcons} height='1em' />
</Grid.Col>
<Grid.Col className={'column-label'} span={columnLabelSpanSize}>
{formatJSX(item.jsx)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useEffect } from 'react';
import { Input } from '@mantine/core';
import { debounce } from 'lodash';
import SearchIcon from '../Icons/SearchIcon';
import { IColumnManagementData, IRowData } from '../../Interfaces/Interfaces';
import SearchBarMessage from './SearchBarMessage/SearchBarMessage';
import filterTableData from './filterTableData';
import IconComponent from '../../../../../components/Icon';
import dictIcons from '../../../../../img/icons/index';

interface ISearchBarProps {
columnsShown: number;
Expand Down Expand Up @@ -62,7 +63,7 @@ const SearchBar = ({
x
</button>
) : (
<SearchIcon />
<IconComponent iconName='search' dictIcons={dictIcons} height='1em' />
)
}
placeholder='Search'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from '@mantine/core';
import React from 'react';
import EyeIcon from '../../Icons/EyeIcon';
import InfoIcon from '../../Icons/InfoIcon';
import IconComponent from '../../../../../../components/Icon';
import dictIcons from '../../../../../../img/icons/index';
import showSearchBarMessage from './showSearchBarMessage';
import { IColumnManagementData, IRowData } from '../../../Interfaces/Interfaces';

Expand All @@ -18,10 +18,10 @@ const SearchBarMessage = ({
if (showSearchBarMessage(searchTerm, paginatedData, columnManagementData)) {
return (
<div className='search-bar-message'>
<span><InfoIcon /></span>
<span><IconComponent iconName='info' dictIcons={dictIcons} height='1em' /></span>
Matches found in hidden columns.
<Button
leftIcon={<EyeIcon />}
leftIcon={<IconComponent iconName='gwas-eyeIcon' dictIcons={dictIcons} height='1em' />}
data-testid='show-all-button'
variant='outline'
onClick={() => columnManagementReset()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import {
IRowData,
IColumnManagementData,
} from '../../Interfaces/Interfaces';
import ExpandIcon from '../Icons/ExpandIcon';
import CollapseIcon from '../Icons/CollapseIcon';
import {
checkIfCellContainsSearchTerm,
checkIfHiddenCellsContainSearchTerm,
Expand Down Expand Up @@ -63,8 +61,9 @@ const TableRow = ({
size='xs'
compact
onClick={() => handleTableChange('openDropdown', rowObject.rowID)}
aria-label='expand'
>
<ExpandIcon />
<span className='arrow-icon arrow-icon-right' data-testid='expand-icon' />
</Button>
)}
{currentDropdownShouldBeOpen && (
Expand All @@ -73,8 +72,9 @@ const TableRow = ({
size='xs'
compact
onClick={() => handleTableChange('closeDropdown', rowObject.rowID)}
aria-label='collapse'
>
<CollapseIcon />
<span className='arrow-icon arrow-icon-down' />
</Button>
)}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { useQuery } from 'react-query';
import { Spin } from 'antd';
import { fetchConceptStatsByHareSubset } from '../../../Utils/cohortMiddlewareApi';
import queryConfig from '../../../../SharedUtils/QueryConfig';
import BarChart from '../ChartIcons/BarChart';
import EulerDiagram from '../ChartIcons/EulerDiagram';
import IconComponent from '../../../../../components/Icon';
import dictIcons from '../../../../../img/icons/index';
import { useSourceContext } from '../../../Utils/Source';

const AttritionTableRow = ({
Expand Down Expand Up @@ -87,10 +87,10 @@ const AttritionTableRow = ({
const determineChartIcon = () => {
if (rowType === 'Covariate' || rowType === 'Outcome') {
if (rowObject.variable_type === 'concept') {
return <BarChart />;
return <IconComponent iconName='gwas-barChart' dictIcons={dictIcons} />;
}
if (rowObject.variable_type === 'custom_dichotomous') {
return <EulerDiagram />;
return <IconComponent iconName='gwas-eulerDiagram' dictIcons={dictIcons} />;
}
throw new Error(
`Invalid Row Type: ${rowType} and rowObject.variable_type ${JSON.stringify(
Expand Down
Loading
Loading