Skip to content

Commit c73dbce

Browse files
authored
Merge pull request #37 from oslabs-beta/staging
Merge PR #35 from Staging to Main
2 parents 100ed6c + 963aec6 commit c73dbce

File tree

15 files changed

+239
-147
lines changed

15 files changed

+239
-147
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@import '../../../assets/stylesheets/fonts.scss';
2+
@import '../../../assets/stylesheets/colors.scss';
3+
4+
#CatTagFilter {
5+
font-weight: bold;
6+
font-size: 0.75rem;
7+
position: relative;
8+
margin-left: 5px;
9+
margin-top: 10px;
10+
z-index: 3;
11+
12+
#accTestCatTypes:focus {
13+
border: 2px solid darkblue;
14+
}
15+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from 'react';
2+
import styles from './CatTagFilter.module.scss';
3+
4+
const CatTagFilter = ({ dispatch, tagAction, textAction, itId, catTag }) => {
5+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
6+
dispatch(tagAction(itId, e.target.value));
7+
if (e.target.value === 'none') dispatch(textAction(`Component is accessible regarding all axe-core categories.`, itId));
8+
else dispatch(textAction(`Component is accessible regarding ${e.target.value}.`, itId));
9+
};
10+
11+
return (
12+
<div id={styles.CatTagFilter}>
13+
<label for='accTestCatTypes'>Choose A Content Filter: </label>
14+
<select value={catTag} id={styles.accTestCatTypes} onChange={handleChange}>
15+
<option value='none'>No Tag</option>
16+
<option value='aria'>ARIA</option>
17+
<option value='color'>Color</option>
18+
<option value='forms'>Forms</option>
19+
<option value='keyboard'>Keyboard</option>
20+
<option value='language'>Language</option>
21+
<option value='name-role-value'>Name role value</option>
22+
<option value='parsing'>Parsing</option>
23+
<option value='semantics'>Semantics</option>
24+
<option value='sensory-and-visual-cues'>Sensory and visual cues</option>
25+
<option value='structure'>Structure</option>
26+
<option value='tables'>Tables</option>
27+
<option value='text-alternatives'>Text alternatives</option>
28+
<option value='time-and-media'>Time and media</option>
29+
</select>
30+
</div>
31+
);
32+
};
33+
34+
export default CatTagFilter;

src/components/AccTestComponent/CustomInput/CustomInput.module.scss

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/components/AccTestComponent/CustomInput/CustomInput.tsx

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/components/AccTestComponent/DescribeRenderer/DescribeRenderer.module.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
display: flex;
1313
flex-direction: column;
1414
z-index: 0;
15-
margin-top: 1rem;
1615

1716
.describeClose {
1817
position: absolute;
@@ -35,7 +34,7 @@
3534
top: 0;
3635
left: 0;
3736
width: 100%;
38-
height: 65px;
37+
height: 100px;
3938
// background-color: rgba(128, 128, 128, 0.20);
4039
background-color: #02c3c33f;
4140
border-bottom: 2px solid gray;
@@ -50,11 +49,12 @@
5049
font-family: $oxygen;
5150
}
5251

53-
.describeInput {
52+
.describeStatement {
5453
border: none;
55-
// border-bottom: 1px solid $mint;
54+
border-bottom: 1px solid $mint;
5655
background-color: rgba(0, 0, 0, 0);
57-
margin-top: 0.3rem;
56+
margin-top: .8rem;
57+
margin-bottom: .8rem;
5858
font-size: 0.9rem;
5959
z-index: 3;
6060
}

src/components/AccTestComponent/DescribeRenderer/DescribeRenderer.tsx

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import React, { useRef, useEffect, ChangeEvent } from 'react';
1+
import React, { ChangeEvent } from 'react';
22
import cn from 'classnames';
33
import { Draggable, Droppable } from 'react-beautiful-dnd';
44
import ItRenderer from '../ItRenderer/ItRenderer';
5+
import StandardTagFilter from '../StandardTagFilter/StandardTagFilter';
56
import styles from './DescribeRenderer.module.scss';
67
import { deleteDescribeBlock, addItStatement } from '../../../context/actions/accTestCaseActions';
7-
import { AccTestCaseState } from '../../../utils/accTypes';
88

99
const DescribeRenderer = ({
1010
dispatcher,
1111
describeBlocks,
1212
itStatements,
13-
handleChangeDescribeText,
14-
handleChangeItStatementText,
13+
updateDescribeText,
14+
updateItStatementText,
15+
updateDescribeStandardTag,
16+
updateItCatTag,
1517
type,
1618
}) => {
17-
18-
1919
const deleteDescribeBlockHandleClick = (e: ChangeEvent) => {
2020
e.stopPropagation();
2121
const describeId = e.target.id;
@@ -27,14 +27,14 @@ const DescribeRenderer = ({
2727
dispatcher(addItStatement(describeId));
2828
};
2929

30-
const deleteDescribeBlockOnKeyUp = (e) => {
30+
const deleteDescribeBlockOnKeyUp = (e: ChangeEvent) => {
3131
if (e.charCode === 13) {
32-
const describeId = e.target.id;
33-
dispatcher(deleteDescribeBlock(describeId));
32+
const describeId = e.target.id;
33+
dispatcher(deleteDescribeBlock(describeId));
3434
}
35-
}
35+
};
3636

37-
return describeBlocks.allIds.map((id: string , i: number) => (
37+
return describeBlocks.allIds.map((id: string, i: number) => (
3838
<Draggable
3939
key={id}
4040
draggableId={id}
@@ -51,7 +51,15 @@ const DescribeRenderer = ({
5151
<label htmlFor="describe-label" className={styles.describeLabel}>
5252
Describe Block
5353
</label>
54-
54+
55+
<StandardTagFilter
56+
dispatch={dispatcher}
57+
tagAction={updateDescribeStandardTag}
58+
textAction={updateDescribeText}
59+
describeId={id}
60+
standardTag={describeBlocks.byId[id].standardTag}
61+
/>
62+
5563
<i
5664
tabIndex={0}
5765
onKeyPress={deleteDescribeBlockOnKeyUp}
@@ -60,18 +68,7 @@ const DescribeRenderer = ({
6068
className={cn('far fa-window-close', styles.describeClose)}
6169
/>
6270

63-
64-
<input
65-
66-
id={id}
67-
className={styles.describeInput}
68-
name="describe-label"
69-
type="text"
70-
placeholder="Component has basic accessibility"
71-
value={describeBlocks.byId[id].text || ''}
72-
onChange={handleChangeDescribeText}
73-
/>
74-
71+
<p className={styles.describeStatement}>{describeBlocks.byId[id].text}</p>
7572
<div className={styles.separator} />
7673

7774
<Droppable
@@ -88,7 +85,8 @@ const DescribeRenderer = ({
8885
key={`it-${id}-${i}`}
8986
itStatements={itStatements}
9087
describeId={id}
91-
handleChangeItStatementText={handleChangeItStatementText}
88+
updateItStatementText={updateItStatementText}
89+
updateItCatTag={updateItCatTag}
9290
/>
9391
{innerProvided.placeholder}
9492
</div>

src/components/AccTestComponent/ItRenderer/ItRenderer.module.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
background-color: $light-gray2;
1111
border-radius: 3px;
1212
box-shadow: 2px 2px 5px gray;
13+
height: 100px;
1314

1415
.itClose {
1516
position: absolute;
@@ -18,6 +19,7 @@
1819
right: 5px;
1920
transition: 250ms;
2021
cursor: pointer;
22+
z-index: 3;
2123

2224
&:hover {
2325
color: red;
@@ -26,6 +28,17 @@
2628
}
2729
}
2830

31+
.itStatement {
32+
position: absolute;
33+
bottom: 15px;
34+
width: 97.4%;
35+
padding: 0.1rem;
36+
padding-left: 0.4rem;
37+
font-size: 1.1em;
38+
border-bottom: 1px solid $mint;
39+
background-color: rgba(0, 0, 0, 0);
40+
}
41+
2942
.buttonsContainer {
3043
margin-top: 1rem;
3144
display: flex;

src/components/AccTestComponent/ItRenderer/ItRenderer.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import React, { ChangeEvent, useContext } from 'react';
22
import cn from 'classnames';
33
import { Draggable } from 'react-beautiful-dnd';
44
import { AccTestCaseContext } from '../../../context/reducers/accTestCaseReducer';
5+
import CatTagFilter from '../CatTagFilter/CatTagFilter';
56

67
import {
78
deleteItStatement,
89
} from '../../../context/actions/accTestCaseActions';
910

10-
import CustomInput from '../CustomInput/CustomInput';
11-
1211
import styles from './ItRenderer.module.scss';
1312

1413
const ItRenderer = ({
1514
itStatements,
1615
describeId,
17-
handleChangeItStatementText,
16+
updateItStatementText,
17+
updateItCatTag,
1818
}) => {
1919

2020
const [, dispatchToAccTestCase] = useContext(AccTestCaseContext);
@@ -45,6 +45,14 @@ const ItRenderer = ({
4545
key={i}
4646
>
4747

48+
<CatTagFilter
49+
dispatch={dispatchToAccTestCase}
50+
tagAction={updateItCatTag}
51+
textAction={updateItStatementText}
52+
itId={id}
53+
catTag={itStatements.byId[id].catTag}
54+
/>
55+
4856
<i
4957
tabIndex={0}
5058
onKeyPress={deleteItStatementOnKeyUp}
@@ -53,14 +61,7 @@ const ItRenderer = ({
5361
className={cn(styles.itClose, 'far fa-window-close')}
5462
/>
5563

56-
<CustomInput
57-
key={`input-${id}-${i}`}
58-
id={id}
59-
label={'The element should...'}
60-
placeholder={'The tested element should...'}
61-
value={itStatements.byId[id].text}
62-
handleChange={handleChangeItStatementText}
63-
/>
64+
<p class={styles.itStatement}>{itStatements.byId[id].text}</p>
6465
<hr />
6566

6667
</div>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@import '../../../assets/stylesheets/fonts.scss';
2+
@import '../../../assets/stylesheets/colors.scss';
3+
4+
#StandardTagFilter {
5+
font-weight: bold;
6+
font-size: 0.8rem;
7+
position: relative;
8+
margin-top: 10px;
9+
z-index: 3;
10+
11+
#accTestStandardTypes:focus {
12+
border: 2px solid darkblue;
13+
}
14+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from 'react';
2+
import styles from './StandardTagFilter.module.scss';
3+
4+
const StandardTagFilter = ({ dispatch, tagAction, textAction, describeId, standardTag }) => {
5+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
6+
dispatch(tagAction(describeId, e.target.value));
7+
if (e.target.value === 'none') dispatch(textAction(`Component is accessible according to all standards enforced by axe-core.`, describeId));
8+
else dispatch(textAction(`Component is accessible according to ${e.target.value} standards.`, describeId));
9+
};
10+
11+
return (
12+
<div id={styles.StandardTagFilter}>
13+
<label for='accTestStandardTypes'>Choose An Accessibility Standard: </label>
14+
<select value={standardTag} id={styles.accTestStandardTypes} onChange={handleChange}>
15+
<option value='none'>No Tag</option>
16+
<option value='wcag2a'>WCAG 2.0 Level A</option>
17+
<option value='wcag2aa'>WCAG 2.0 Level AA</option>
18+
<option value='wcag21a'>WCAG 2.1 Level A</option>
19+
<option value='wcag21aa'>WCAG 2.1 Level AA</option>
20+
<option value='best-practice'>Common best practices</option>
21+
<option value='ACT'>ACT (by W3C)</option>
22+
<option value='section508'>Section 508</option>
23+
<option value='experimental'>Experimental (auto-disabled)</option>
24+
</select>
25+
</div>
26+
);
27+
};
28+
29+
export default StandardTagFilter;

0 commit comments

Comments
 (0)