-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EDSC-4322: Refactor
CustomizableIcons.jsx
and fix styling inconsist…
…encies (#1842) * EDSC-4322: Fix portal mock test * EDSC-4322: Fix Customizable Icons styling * EDSC-4322: Match colors of nearby similar buttons * EDSC-4322: Refactor customizable icons component and where its being called * EDSC-4322: Fixing customizable icon tooltips * EDSC-4322: Clean up styling remove unused classes * EDSC-4322: Fix naming convention, tweak background color to match other selected buttons when hovered
- Loading branch information
1 parent
fcae98f
commit 3f1a79a
Showing
18 changed files
with
522 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
static/src/js/components/AvailableCustomizationsIcons/AvailableCustomizationsIcons.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
import { FileGeneric, Filter } from '@edsc/earthdata-react-icons/horizon-design-system/hds/ui' | ||
|
||
import { | ||
FaClock, | ||
FaCubes, | ||
FaGlobe, | ||
FaTags | ||
} from 'react-icons/fa' | ||
|
||
import EDSCIcon from '../EDSCIcon/EDSCIcon' | ||
|
||
import './AvailableCustomizationsIcons.scss' | ||
|
||
/** | ||
* Renders icons indicating customization options for access methods. | ||
* @param {boolean} hasSpatialSubsetting | ||
* @param {boolean} hasVariables | ||
* @param {boolean} hasTransforms | ||
* @param {boolean} hasFormats | ||
* @param {boolean} hasTemporalSubsetting | ||
* @param {boolean} hasCombine | ||
*/ | ||
export const AvailableCustomizationsIcons = ({ | ||
hasSpatialSubsetting, | ||
hasVariables, | ||
hasTransforms, | ||
hasFormats, | ||
hasTemporalSubsetting, | ||
hasCombine | ||
}) => ( | ||
hasSpatialSubsetting | ||
|| hasVariables | ||
|| hasTransforms | ||
|| hasFormats | ||
|| hasTemporalSubsetting | ||
|| hasCombine | ||
) && ( | ||
<> | ||
{ | ||
hasSpatialSubsetting && ( | ||
<EDSCIcon | ||
className="available-customizations-icons__icon" | ||
title="A white globe icon" | ||
icon={FaGlobe} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
{ | ||
hasTemporalSubsetting && ( | ||
<EDSCIcon | ||
className="available-customizations-icons__icon" | ||
title="A white clock icon" | ||
icon={FaClock} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
{ | ||
hasVariables && ( | ||
<EDSCIcon | ||
className="available-customizations-icons__icon" | ||
title="A white tags icon" | ||
icon={FaTags} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
{ | ||
hasTransforms && ( | ||
<EDSCIcon | ||
className="available-customizations-icons__icon" | ||
title="A white horizontal sliders icon" | ||
icon={Filter} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
{ | ||
hasFormats && ( | ||
<EDSCIcon | ||
className="available-customizations-icons__icon" | ||
title="A white file icon" | ||
icon={FileGeneric} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
{ | ||
hasCombine && ( | ||
<EDSCIcon | ||
className="available-customizations-icons__icon" | ||
title="A white cubes icon" | ||
icon={FaCubes} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
</> | ||
) | ||
|
||
AvailableCustomizationsIcons.defaultProps = { | ||
hasSpatialSubsetting: false, | ||
hasVariables: false, | ||
hasTransforms: false, | ||
hasFormats: false, | ||
hasTemporalSubsetting: false, | ||
hasCombine: false | ||
} | ||
|
||
AvailableCustomizationsIcons.propTypes = { | ||
hasSpatialSubsetting: PropTypes.bool, | ||
hasVariables: PropTypes.bool, | ||
hasTransforms: PropTypes.bool, | ||
hasFormats: PropTypes.bool, | ||
hasTemporalSubsetting: PropTypes.bool, | ||
hasCombine: PropTypes.bool | ||
} | ||
|
||
export default AvailableCustomizationsIcons |
13 changes: 13 additions & 0 deletions
13
static/src/js/components/AvailableCustomizationsIcons/AvailableCustomizationsIcons.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.available-customizations-icons { | ||
border-bottom: 1px solid $border-color; | ||
|
||
&__icon { | ||
margin-right: 0.25rem; | ||
position: relative; | ||
top: -0.05rem; | ||
|
||
&:last-child { | ||
margin-right: 0; | ||
} | ||
} | ||
} |
145 changes: 145 additions & 0 deletions
145
...ic/src/js/components/AvailableCustomizationsIcons/AvailableCustomizationsTooltipIcons.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
import { FileGeneric, Filter } from '@edsc/earthdata-react-icons/horizon-design-system/hds/ui' | ||
|
||
import { | ||
FaClock, | ||
FaCubes, | ||
FaGlobe, | ||
FaTags | ||
} from 'react-icons/fa' | ||
|
||
import EDSCIcon from '../EDSCIcon/EDSCIcon' | ||
import './AvailableCustomizationsTooltipIcons.scss' | ||
|
||
/** | ||
* Renders tool-tip-icons indicating customization options for access methods. | ||
* @param {boolean} hasSpatialSubsetting | ||
* @param {boolean} hasVariables | ||
* @param {boolean} hasTransforms | ||
* @param {boolean} hasFormats | ||
* @param {boolean} hasTemporalSubsetting | ||
* @param {boolean} hasCombine | ||
*/ | ||
export const AvailableCustomizationsTooltipIcons = ({ | ||
hasSpatialSubsetting, | ||
hasVariables, | ||
hasTransforms, | ||
hasFormats, | ||
hasTemporalSubsetting, | ||
hasCombine | ||
}) => ( | ||
hasSpatialSubsetting | ||
|| hasVariables | ||
|| hasTransforms | ||
|| hasFormats | ||
|| hasTemporalSubsetting | ||
|| hasCombine | ||
) && ( | ||
<> | ||
<div> | ||
Supports customization: | ||
</div> | ||
<ul className="available-customizations-tooltip-icons__tooltip-feature-list"> | ||
{ | ||
hasSpatialSubsetting && ( | ||
<li> | ||
<EDSCIcon | ||
className="available-customizations-tooltip-icons__tooltip-feature-icon" | ||
title="A white globe icon" | ||
size="0.725rem" | ||
icon={FaGlobe} | ||
/> | ||
Spatial subset | ||
</li> | ||
) | ||
} | ||
{ | ||
hasTemporalSubsetting && ( | ||
<li> | ||
<EDSCIcon | ||
className="available-customizations-tooltip-icons__tooltip-feature-icon" | ||
title="A white clock icon" | ||
size="0.725rem" | ||
icon={FaClock} | ||
/> | ||
Temporal subset | ||
</li> | ||
) | ||
} | ||
{ | ||
hasVariables && ( | ||
<li> | ||
<EDSCIcon | ||
className="available-customizations-tooltip-icons__tooltip-feature-icon" | ||
title="A white tags icon" | ||
size="0.725rem" | ||
icon={FaTags} | ||
/> | ||
Variable subset | ||
</li> | ||
) | ||
} | ||
{ | ||
hasTransforms && ( | ||
<li> | ||
<EDSCIcon | ||
className="available-customizations-tooltip-icons__tooltip-feature-icon" | ||
title="A white horizontal sliders icon" | ||
size="0.725rem" | ||
icon={Filter} | ||
/> | ||
Transform | ||
</li> | ||
) | ||
} | ||
{ | ||
hasFormats && ( | ||
<li> | ||
<EDSCIcon | ||
className="available-customizations-tooltip-icons__tooltip-feature-icon" | ||
title="A white file icon" | ||
size="0.725rem" | ||
icon={FileGeneric} | ||
/> | ||
Reformat | ||
</li> | ||
) | ||
} | ||
{ | ||
hasCombine && ( | ||
<li> | ||
<EDSCIcon | ||
className="available-customizations-tooltip-icons__tooltip-feature-icon" | ||
title="A white cubes icon" | ||
size="0.725rem" | ||
icon={FaCubes} | ||
/> | ||
Combine | ||
</li> | ||
) | ||
} | ||
</ul> | ||
</> | ||
) | ||
|
||
AvailableCustomizationsTooltipIcons.defaultProps = { | ||
hasSpatialSubsetting: false, | ||
hasVariables: false, | ||
hasTransforms: false, | ||
hasFormats: false, | ||
hasTemporalSubsetting: false, | ||
hasCombine: false | ||
} | ||
|
||
AvailableCustomizationsTooltipIcons.propTypes = { | ||
hasSpatialSubsetting: PropTypes.bool, | ||
hasVariables: PropTypes.bool, | ||
hasTransforms: PropTypes.bool, | ||
hasFormats: PropTypes.bool, | ||
hasTemporalSubsetting: PropTypes.bool, | ||
hasCombine: PropTypes.bool | ||
} | ||
|
||
export default AvailableCustomizationsTooltipIcons |
14 changes: 14 additions & 0 deletions
14
...c/src/js/components/AvailableCustomizationsIcons/AvailableCustomizationsTooltipIcons.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.available-customizations-tooltip-icons { | ||
&__tooltip-feature-list { | ||
width: auto; | ||
margin: 0 auto; | ||
padding: 0; | ||
list-style: none; | ||
text-align: center; | ||
} | ||
|
||
&__tooltip-feature-icon { | ||
margin-right: 0.325rem; | ||
color: $color__carbon--30; | ||
} | ||
} |
Oops, something went wrong.