Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/babel/traverse-7.23.2
Browse files Browse the repository at this point in the history
  • Loading branch information
staxly[bot] authored Jul 25, 2024
2 parents ed3238b + 4c6396b commit 6b84e86
Show file tree
Hide file tree
Showing 8 changed files with 2,066 additions and 1,898 deletions.
1 change: 1 addition & 0 deletions src/app/components/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const CustomCheckbox = styled(
display: flex;
justify-content: center;
align-items: center;
flex-shrink: 0;
input:not(:checked) + & {
border: 1px solid ${theme.color.primary.gray.darker};
Expand Down
15 changes: 9 additions & 6 deletions src/app/content/components/popUp/ChapterFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ const Row = styled.div`
`;

// tslint:disable-next-line:variable-name
const Column = styled.div`
const Column = styled.ul`
display: flex;
flex-direction: column;
overflow-x: hidden;
list-style: none;
margin: 0;
padding: 0;
`;

// tslint:disable-next-line:variable-name
Expand Down Expand Up @@ -119,11 +122,11 @@ const ChapterFilter = (props: ChapterFilterProps) => {
)
: null}
<Row>
{sectionChunks.map((sectionChunk, index) => <Column key={index}>
{sectionChunks.map((sectionChunk, index) => <Column key={index} aria-label='Filter by chapters'>
{sectionChunk.map((location) => {
const { section, children } = location;
if (!children) {
return <ChapterFilterItem
return <li><ChapterFilterItem
key={section.id}
selected={props.selectedLocationFilters.has(section.id)}
disabled={props.disabled || !props.locationFiltersWithContent.has(section.id)}
Expand All @@ -132,9 +135,9 @@ const ChapterFilter = (props: ChapterFilterProps) => {
onChange={() => handleChange(section)}
ariaLabel={getAriaLabel(section)}
dataAnalyticsLabel={`Filter PQ by ${splitTitleParts(section.title).join(' ')}`}
/>;
/></li>;
} else {
return <StyledDetails key={section.id} open={openChapterId === section.id}>
return <li><StyledDetails key={section.id} open={openChapterId === section.id}>
<StyledSummary onClick={(ev: React.MouseEvent) => {
ev.preventDefault();
setOpenChapterId((currentId) => currentId !== section.id ? section.id : null);
Expand All @@ -156,7 +159,7 @@ const ChapterFilter = (props: ChapterFilterProps) => {
/>
))}
</StyledChapterFilterItemWrapper>
</StyledDetails>;
</StyledDetails></li>;
}
})}
</Column>)}
Expand Down
42 changes: 28 additions & 14 deletions src/app/content/components/popUp/ColorFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styled, { css } from 'styled-components/macro';
import AllOrNone from '../../../components/AllOrNone';
import Checkbox from '../../../components/Checkbox';
import { textStyle } from '../../../components/Typography/base';
import theme from '../../../theme';
import theme, { hiddenButAccessible } from '../../../theme';
import { highlightStyles } from '../../constants';
import ColorIndicator from '../../highlights/components/ColorIndicator';
import { filters, mobileMarginSides } from '../../styles/PopupConstants';
Expand All @@ -19,6 +19,17 @@ const ColorLabel = styled.span`
white-space: nowrap;
`;

// tslint:disable-next-line: variable-name
const Fieldset = styled.fieldset`
padding: 0;
border: none;
margin: 0;
legend {
${hiddenButAccessible}
}
`;

export interface ColorFilterProps {
className?: string;
disabled?: boolean;
Expand Down Expand Up @@ -60,19 +71,22 @@ const ColorFilter = ({
onAll={() => setSelectedColors({ remove: [], new: Array.from(colorFiltersWithContent) })}
disabled={disabled}
/>
{styles.map((style) => <Checkbox
key={style.label}
checked={selectedColorFilters.has(style.label)}
disabled={disabled || !colorFiltersWithContent.has(style.label)}
onChange={() => handleChange(style.label)}
>
<ColorIndicator style={style} size='small'/>
<ColorLabel>
<FormattedMessage id={labelKey(style.label)}>
{(msg) => msg}
</FormattedMessage>
</ColorLabel>
</Checkbox>)}
<Fieldset>
<legend>Filter by colors</legend>
{styles.map((style) => <Checkbox
key={style.label}
checked={selectedColorFilters.has(style.label)}
disabled={disabled || !colorFiltersWithContent.has(style.label)}
onChange={() => handleChange(style.label)}
>
<ColorIndicator style={style} size='small'/>
<ColorLabel>
<FormattedMessage id={labelKey(style.label)}>
{(msg) => msg}
</FormattedMessage>
</ColorLabel>
</Checkbox>)}
</Fieldset>
</div>;
};

Expand Down
Loading

0 comments on commit 6b84e86

Please sign in to comment.