Skip to content

Commit 577644c

Browse files
authored
Merge pull request #34 from andriawang6/hide-explanations-big-o
update big-o modal
2 parents eb41d17 + 2b45383 commit 577644c

3 files changed

Lines changed: 17 additions & 105 deletions

File tree

src/components/BigOInfo.js

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

src/css/App.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ div.content {
512512
max-height: 100%;
513513
object-fit: contain;
514514
transition: transform var(--transition-speed) ease;
515+
align-items: center;
515516
}
516517

517518
.algo-container:hover .algo-picture img {

src/modals/BigOModals.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,19 @@ const renderRows = data => {
2929
<tbody>
3030
{Object.keys(operationData).map(complexity => (
3131
<tr key={complexity}>
32-
<td style={{ width: '13%' }}>
32+
<td style={{ width: '15%' }}>
3333
{complexity[0].toUpperCase() + complexity.slice(1)}
3434
</td>
35-
<ToggleBlurCell text={operationData[complexity].big_o} />
36-
<td>{applyEquationClass(operationData[complexity].explanation)}</td>
35+
<ToggleBlurCell
36+
text={operationData[complexity].big_o}
37+
width={'25%'}
38+
force={true}
39+
/>
40+
<ToggleBlurCell
41+
text={operationData[complexity].explanation}
42+
width={'60%'}
43+
force={false}
44+
/>
3745
</tr>
3846
))}
3947
</tbody>
@@ -43,20 +51,16 @@ const renderRows = data => {
4351
});
4452
};
4553

46-
const ToggleBlurCell = ({ text }) => {
54+
const ToggleBlurCell = ({ text, width, force }) => {
4755
const [isBlurred, setIsBlurred] = useState(true);
4856

49-
const handleMouseEnter = () => {
50-
setIsBlurred(false);
51-
};
52-
5357
return (
5458
<td
55-
style={{ width: '16%' }}
59+
style={{ width: width }}
5660
className={isBlurred ? 'blur big_o_cell' : 'big_o_cell'}
57-
onMouseEnter={handleMouseEnter}
61+
onClick={() => isBlurred ? setIsBlurred(false) : setIsBlurred(true)}
5862
>
59-
{applyEquationClass(text, true)}
63+
{applyEquationClass(text, force)}
6064
</td>
6165
);
6266
};
@@ -86,6 +90,7 @@ const Modals = page => {
8690
<div className="button-container">
8791
<button onClick={toggleBlur}>Reveal All Big-O</button>
8892
</div>
93+
<text> Click to reveal answer </text>
8994
{renderRows(timeComplexities[page])}
9095
</div>
9196
) : null;

0 commit comments

Comments
 (0)