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

EDSC-4322: Refactor CustomizableIcons.jsx and fix styling inconsistencies #1842

Merged
merged 14 commits into from
Dec 30, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ To ensure that you're using the correct version of Node it is recommended that y

nvm use

##### Serverless Framework
##### Running Serverless Framework locally

Earthdata Search utilizes the [Serverless Framework](https://serverless.com/) for managing AWS resources. In order to fully run and manage the application you'll need to install it:

Expand Down
14 changes: 8 additions & 6 deletions static/src/js/components/AccessMethod/AccessMethod.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
margin-left: $spacer;

&:hover {
background-color: $color__carbon--10;
background-color: $color__carbon--5;
}
}

Expand Down Expand Up @@ -91,17 +91,19 @@
}

.harmony-select-item {
line-height: 1;
display: flex;
align-items: center;
height: auto;
position: relative;
user-select: none;
}

.harmony-select-item[data-highlighted] {
outline: none;
background-color: $color__carbon--10;
&:hover {
background-color: $color__carbon--5;

.meta-icon__metadata {
background-color: $color__carbon--20;
}
}
}

.harmony-scroll-area-root {
Expand Down
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
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;
}
}
}
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
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;
}
}
Loading
Loading