-
Notifications
You must be signed in to change notification settings - Fork 224
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
EDSC-4322: Refactor CustomizableIcons.jsx
and fix styling inconsistencies
#1842
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
14284e9
EDSC-4322: Fix portal mock test
eudoroolivares2016 13cdb9d
EDSC-4322: Fix Customizable Icons styling
eudoroolivares2016 c96ede4
EDSC-4322: Match colors of nearby similar buttons
eudoroolivares2016 a02edaf
EDSC-4322: Refactor customizable icons and where its being called
eudoroolivares2016 b4d2ca1
EDSC-4322: Fixing customizable icon tooltips
eudoroolivares2016 c813288
EDSC-4322: Clean up styling remove unused classes
eudoroolivares2016 0ce75ef
EDSC-4322: Renaming files
eudoroolivares2016 2c66bc9
EDSC-4322: rename var
eudoroolivares2016 73f3785
EDSC-4322: Add tests and fix one test mistake
eudoroolivares2016 8538ec4
EDSC-4322: Fix readme mistake
eudoroolivares2016 3d40d3f
ESDC-4322: Cleanup
eudoroolivares2016 5f4e59b
EDSC-4322: Update var name remove class not being used
eudoroolivares2016 2258a52
EDSC-4322: Fix naming convention, tweak background color to match oth…
eudoroolivares2016 535e25f
EDSC-4322: Pluralize consistently
eudoroolivares2016 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 AvailableCustomizationsTooltipIcons = ({ | ||
eudoroolivares2016 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
hasSpatialSubsetting, | ||
hasVariables, | ||
hasTransforms, | ||
hasFormats, | ||
hasTemporalSubsetting, | ||
hasCombine | ||
}) => ( | ||
hasSpatialSubsetting | ||
|| hasVariables | ||
|| hasTransforms | ||
|| hasFormats | ||
|| hasTemporalSubsetting | ||
|| hasCombine | ||
) && ( | ||
<> | ||
{ | ||
hasSpatialSubsetting && ( | ||
<EDSCIcon | ||
className="available-customization-icons__icon" | ||
title="A white globe icon" | ||
icon={FaGlobe} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
{ | ||
hasTemporalSubsetting && ( | ||
<EDSCIcon | ||
className="available-customization-icons__icon" | ||
title="A white clock icon" | ||
icon={FaClock} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
{ | ||
hasVariables && ( | ||
<EDSCIcon | ||
className="available-customization-icons__icon" | ||
title="A white tags icon" | ||
icon={FaTags} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
{ | ||
hasTransforms && ( | ||
<EDSCIcon | ||
className="available-customization-icons__icon" | ||
title="A white horizontal sliders icon" | ||
icon={Filter} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
{ | ||
hasFormats && ( | ||
<EDSCIcon | ||
className="available-customization-icons__icon" | ||
title="A white file icon" | ||
icon={FileGeneric} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
{ | ||
hasCombine && ( | ||
<EDSCIcon | ||
className="available-customization-icons__icon" | ||
title="A white cubes icon" | ||
icon={FaCubes} | ||
size="0.675rem" | ||
/> | ||
) | ||
} | ||
</> | ||
) | ||
|
||
AvailableCustomizationsTooltipIcons.defaultProps = { | ||
eudoroolivares2016 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
hasSpatialSubsetting: false, | ||
hasVariables: false, | ||
hasTransforms: false, | ||
hasFormats: false, | ||
hasTemporalSubsetting: false, | ||
hasCombine: false | ||
} | ||
|
||
AvailableCustomizationsTooltipIcons.propTypes = { | ||
eudoroolivares2016 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
hasSpatialSubsetting: PropTypes.bool, | ||
hasVariables: PropTypes.bool, | ||
hasTransforms: PropTypes.bool, | ||
hasFormats: PropTypes.bool, | ||
hasTemporalSubsetting: PropTypes.bool, | ||
hasCombine: PropTypes.bool | ||
} | ||
|
||
export default AvailableCustomizationsTooltipIcons | ||
eudoroolivares2016 marked this conversation as resolved.
Show resolved
Hide resolved
|
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-customization-icons { | ||
border-bottom: 1px solid $border-color; | ||
|
||
&__icon { | ||
margin-right: 0.25rem; | ||
position: relative; | ||
top: -0.05rem; | ||
|
||
&:last-child { | ||
margin-right: 0; | ||
} | ||
} | ||
} |
147 changes: 147 additions & 0 deletions
147
...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,147 @@ | ||
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 = { | ||
forAccessMethodRadio: false, | ||
hasSpatialSubsetting: false, | ||
hasVariables: false, | ||
hasTransforms: false, | ||
hasFormats: false, | ||
hasTemporalSubsetting: false, | ||
hasCombine: false | ||
} | ||
|
||
availableCustomizationsTooltipIcons.propTypes = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried combining these two the issue becomes that these are props to MetaIcon when its used so we'd need to refactor MetaIcon as well and its being used that way in other places as well for non customizable icons |
||
hasSpatialSubsetting: PropTypes.bool, | ||
hasVariables: PropTypes.bool, | ||
hasTransforms: PropTypes.bool, | ||
hasFormats: PropTypes.bool, | ||
hasTemporalSubsetting: PropTypes.bool, | ||
hasCombine: PropTypes.bool, | ||
forAccessMethodRadio: 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; | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to your PR, but could you tweak the hover states on lines 58 and 101 to be
$color__carbon--5
, instead of$color__carbon--10
? That extra contrast will be good.