Skip to content

Commit

Permalink
Updating based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinGuzman committed Sep 6, 2024
1 parent 748dcdd commit 87d4d1d
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 102 deletions.
4 changes: 0 additions & 4 deletions logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const {
colorize,
} = format;

// Supress error handling
// winston.emitErrs = false;
// Set default NYPL agreed upon log levels
const nyplLogLevels = {
levels: {
Expand Down Expand Up @@ -51,8 +49,6 @@ const getLogLevelCode = (levelString) => {
}
};

// const logLevel = (process.env.NODE_ENV === 'production') ? 'info' : 'debug';
// const timestamp = () => new Date().toISOString();
const formatter = printf((options) => {
const result = {
timestamp: options.timestamp,
Expand Down
123 changes: 55 additions & 68 deletions src/app/components/ItemFilters/ItemFilter.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Button, Checkbox, Icon } from '@nypl/design-system-react-components';
// import FocusTrap from 'focus-trap-react';

import { getLabelsForValues, isOptionSelected } from './itemFilterUtils';

Expand Down Expand Up @@ -122,73 +121,61 @@ const ItemFilter = ({
const open = mobile ? mobileIsOpen : isOpen;

return (
// <FocusTrap
// focusTrapOptions={{
// clickOutsideDeactivates: true,
// onDeactivate: () => {
// if (!mobile) manageFilterDisplay('none');
// },
// returnFocusOnDeactivate: false,
// }}
// active={isOpen}
// className="item-filter"
// >
<div className="item-filter">
<Button
buttonType="secondary"
className={`item-filter-button ${open ? ' open' : ''}`}
id="item-filter-button"
onClick={clickHandler}
type="button"
>
{field}{numOfSelections}
<Icon name={open ? 'minus' : 'plus'} size='medium' />
</Button>
{open ? (
<div className="item-filter-content">
<fieldset>
{updatedOptions.map((option, key) => (
<Checkbox
id={option.value}
labelText={option.label}
onChange={() => handleCheckbox(option)}
key={key}
isChecked={isSelected(option)}
__css={{
span: {
fontSize: '15px',
fontWeight: 'medium',
}
}}
/>
))}
</fieldset>
{
!mobile ?
(
<div className="item-filter-buttons">
<Button
buttonType="link"
onClick={() => clear()}
isDisabled={!selectedFields[field].length}
id="clear-filter-button"
>
Clear
</Button>
<Button
onClick={() => submitFilterSelections()}
isDisabled={!selectionMade}
id="apply-filter-button"
>
Apply
</Button>
</div>
) : null
}
</div>
) : null}
</div>
// </FocusTrap>
<div className="item-filter">
<Button
buttonType="secondary"
className={`item-filter-button ${open ? ' open' : ''}`}
id="item-filter-button"
onClick={clickHandler}
type="button"
>
{field}{numOfSelections}
<Icon name={open ? 'minus' : 'plus'} size='medium' />
</Button>
{open ? (
<div className="item-filter-content">
<fieldset>
{updatedOptions.map((option, key) => (
<Checkbox
id={option.value}
labelText={option.label}
onChange={() => handleCheckbox(option)}
key={key}
isChecked={isSelected(option)}
__css={{
span: {
fontSize: '15px',
fontWeight: 'medium',
}
}}
/>
))}
</fieldset>
{
!mobile ?
(
<div className="item-filter-buttons">
<Button
buttonType="link"
onClick={() => clear()}
isDisabled={!selectedFields[field].length}
id="clear-filter-button"
>
Clear
</Button>
<Button
onClick={() => submitFilterSelections()}
isDisabled={!selectionMade}
id="apply-filter-button"
>
Apply
</Button>
</div>
) : null
}
</div>
) : null}
</div>
);
};

Expand Down
47 changes: 18 additions & 29 deletions src/app/components/LoadingLayer/LoadingLayer.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import FocusTrap from 'focus-trap-react';

const LoadingLayer = ({ loading, title, focus }) => {
useEffect(() => {
Expand All @@ -16,36 +15,26 @@ const LoadingLayer = ({ loading, title, focus }) => {


return (
// <FocusTrap
// focusTrapOptions={{
// onDeactivate: () => {
// if (focus) {
// focus();
// }
// },
// }}
// >
<div
className="loadingLayer focus-trap"
aria-labelledby="loading-animation"
aria-describedby="loading-description"
role="alert"
tabIndex="0"
>
<div className="loadingLayer-layer" />
<div className="loadingLayer-texts">
<span id="loading-animation" className="loadingLayer-texts-loadingWord">
Loading...
</span>
<div className="loadingDots">
<span />
<span />
<span />
<span />
</div>
<div
className="loadingLayer focus-trap"
aria-labelledby="loading-animation"
aria-describedby="loading-description"
role="alert"
tabIndex="0"
>
<div className="loadingLayer-layer" />
<div className="loadingLayer-texts">
<span id="loading-animation" className="loadingLayer-texts-loadingWord">
Loading...
</span>
<div className="loadingDots">
<span />
<span />
<span />
<span />
</div>
</div>
// {/* </FocusTrap> */}
</div>
);
};

Expand Down
1 change: 0 additions & 1 deletion src/client/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import ReactDOM from 'react-dom';
import { Router, browserHistory, applyRouterMiddleware } from 'react-router';
import a11y from 'react-a11y';
import { Provider } from 'react-redux';
// import useScroll from 'react-router-scroll/lib/useScroll';

import store from '../app/stores/Store';
import './styles/main.scss';
Expand Down

0 comments on commit 87d4d1d

Please sign in to comment.