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

Ethan/move filters left v1 #328

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e27a4b0
Formatting of label format, remove text
ethanstrominger Apr 6, 2022
d6ef40c
Shortened label
ethanstrominger Apr 6, 2022
22efbfc
Added display or hide overview section
ethanstrominger Apr 11, 2022
21f87ee
Refactored to separate out label formatting
ethanstrominger Apr 11, 2022
c192f4a
WIP
ethanstrominger Apr 11, 2022
c402780
Create a separate tag component
ethanstrominger Apr 12, 2022
b3cb4ba
Formatting, added expand/collapse icon
ethanstrominger Apr 12, 2022
7168127
Fix wording in Projects Overview
ethanstrominger Apr 12, 2022
cae13a3
Moved files
ethanstrominger Apr 12, 2022
fed3091
Accordion formatting
ethanstrominger Apr 13, 2022
21e6f0d
Add dividers
ethanstrominger Apr 14, 2022
dffc90b
Made UnselectedTags into a component
ethanstrominger Apr 14, 2022
826ff56
Added setSelectedItem for MultiSelect
ethanstrominger Apr 14, 2022
1764782
Added setInputValue
ethanstrominger Apr 14, 2022
64be61a
Remove setSelectedItems
ethanstrominger Apr 15, 2022
9e0fbe7
Moved MultiSelect to diff directory
ethanstrominger Apr 15, 2022
9f96e25
Changed onSelectionItemsChange to setSelectedItems
ethanstrominger Apr 15, 2022
d040dc7
Removed console.log
ethanstrominger Apr 15, 2022
25326e5
Changed "Topics" to "Tags"
ethanstrominger Apr 15, 2022
dcba398
Renamed items to availableTags
ethanstrominger Apr 15, 2022
43dec69
More rename items to availableTags
ethanstrominger Apr 15, 2022
e4708bc
Added setIsOpen for modularization
ethanstrominger Apr 15, 2022
afbd0bb
Added setGetItemProps for modularization
ethanstrominger Apr 15, 2022
542067d
Added types for isOpen, inputValue
ethanstrominger Apr 15, 2022
4f4ac2f
Move unselected tags all the way left
ethanstrominger Apr 17, 2022
70023f6
Formatting and todo.txt
ethanstrominger Apr 18, 2022
99b2c56
Make tag input fields same size
ethanstrominger Apr 18, 2022
bc05140
Disable eslint error for BrigadeDataContent.tsx
ethanstrominger Apr 18, 2022
3d2a341
Renaming and organizing
ethanstrominger Apr 18, 2022
40127b1
Fixed clear button
ethanstrominger Apr 18, 2022
dd8d3f7
Adjusted position of x
ethanstrominger Apr 18, 2022
ec80810
Fix clear taxonomy, chg button to collapse/expand
ethanstrominger Apr 18, 2022
f4e1239
Changed from button to span
ethanstrominger Apr 18, 2022
2f077e5
Move filter to left
ethanstrominger Apr 19, 2022
df11832
WIP
ethanstrominger Apr 21, 2022
4c39074
Minor merge from main
ethanstrominger Apr 26, 2022
4156ae0
Remove perfect-scrollbar
ethanstrominger Apr 27, 2022
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
1 change: 1 addition & 0 deletions statusboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"react-perfect-scrollbar": "^1.5.8",
"react-router-dom": "^5.3.0",
"react-scripts": "4.0.3",
"react-split-pane": "^0.1.92",
"react-super-responsive-table": "^5.2.0",
"react-table": "^7.7.0",
"sass": "^1.49.9",
Expand Down
12 changes: 6 additions & 6 deletions statusboard/src/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ function App() {
return (
<div className="App">
<TaxonomyDataContextProvider>
<BrigadeDataContextProvider>
<AppRouter>
<Header />
<PageContents />
</AppRouter>
</BrigadeDataContextProvider>
<BrigadeDataContextProvider>
<AppRouter>
<Header />
<PageContents />
</AppRouter>
</BrigadeDataContextProvider>
</TaxonomyDataContextProvider>
</div>
);
Expand Down
28 changes: 5 additions & 23 deletions statusboard/src/components/Checkbox/Checkbox.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
import React from 'react';
import cx from 'classnames';
import '../commonFormControlStyles.scss';
import './Checkbox.scss';

export default function Checkbox({
label,
id,
onChange,
className = '',
inline = true
}) {
export default function Checkbox({ label, id, onChange }) {
return (
<div
className={cx(
'form-control-container',
{ 'form-control-container--inline': inline },
className
)}
style={{ display: 'flex' }}
>
<label
htmlFor={id}
className={cx('form-label', { 'form-label--inline': inline })}
>
<div className="form-control-container" style={{ display: 'flex' }}>
<label htmlFor={id} className="form-label checkboxLabelAdjustment">
{label}
</label>
<input
type="checkbox"
type="checkbox"
id={id}
onChange={onChange}
className={cx('form-control', { 'form-control--inline': inline })}
className="form-control"
/>
</div>
);
}

5 changes: 5 additions & 0 deletions statusboard/src/components/Divider/Divider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';

export default function Checkbox() {
return <div className="separator" />;
}
158 changes: 0 additions & 158 deletions statusboard/src/components/MultiSelect/MultiSelect.js

This file was deleted.

2 changes: 1 addition & 1 deletion statusboard/src/components/PageContents/PageContents.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.contents {
display: block;
padding: 3rem 5vw 0 5vw;
padding: 1rem 5vw 0 5vw;
}

.text-content {
Expand Down
114 changes: 114 additions & 0 deletions statusboard/src/components/Projects/MultiSelect/MultiSelect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/* eslint-disable react/require-default-props */
/* eslint-disable react/forbid-prop-types */
/* eslint-disable jsx-a11y/label-has-associated-control */
/* eslint-disable react/jsx-props-no-spreading */
/* eslint-disable import/prefer-default-export */
import React from 'react';
import PropTypes from 'prop-types';
import Downshift from 'downshift';
import './MultiSelect.scss';
import { UnselectedTags } from './UnselectedTags';

const displayCollapseExpand = (display) => (display ? collapse : expand);
const collapse = '▲';
const expand = '▼';

function changeHandler({
setSelectedItem,
setInputValue,
inputValue,
setIsOpen,
isOpen,
selectedItems,
setSelectedItems,
}) {
return (selectedItem, downshift) => {
setInputValue(inputValue);
setIsOpen(isOpen);
if (!selectedItem) return;
setSelectedItem(selectedItem);
// setInputValue(inputValue);
// const i = selectedItems.findIndex((item) => item.id === selectedItem.id);
setSelectedItems([...selectedItems, selectedItem]);
downshift.clearSelection();
};
}

// From https://www.axelerant.com/resources/team-blog/using-downshift-create-multi-select-widget-react
export const MultiSelect = ({
availableTags,
inputClassName = '',
labelText,
setSelectedItems,
selectedItems = [],
setSelectedItem,
setIsOpen,
isOpen,
setInputValue,
inputValue,
...rest
}) => (
<>
<Downshift
{...rest}
onChange={changeHandler({
selectedItems,
setSelectedItem,
setIsOpen,
isOpen,
setInputValue,
inputValue,
setSelectedItems,
})}
>
{({
// parameters provided by Downshift
getLabelProps,
getInputProps,
getItemProps,
getToggleButtonProps,
isOpen,
inputValue,
}) => (
<div className="multi-select">
<div className="form-control-container">
<label {...getLabelProps()}>{labelText}</label>
<input
{...getInputProps()}
{...getToggleButtonProps()}
type="text"
width="40px"
className={`form-control ${inputClassName}`}
/>
<span
{...getToggleButtonProps({
className: 'accordionCollapseExpandButton',
})}
>
{displayCollapseExpand(isOpen)}
</span>
</div>
<UnselectedTags
availableTags={availableTags}
selectedItems={selectedItems}
getItemProps={getItemProps}
isOpen={isOpen}
inputValue={inputValue}
/>
</div>
)}
</Downshift>
</>
);

MultiSelect.defaultProps = {};

MultiSelect.propTypes = {
availableTags: PropTypes.array,
labelText: PropTypes.string,
setSelectedItems: PropTypes.func,
getItemProps: PropTypes.func,
isOpen: PropTypes.bool,
selectedItem: {},
inputValue: PropTypes.string,
};
Loading