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

feat: light UI redesign #30

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

feat: light UI redesign #30

wants to merge 22 commits into from

Conversation

postrad
Copy link
Collaborator

@postrad postrad commented May 25, 2020

The current UI isn't quite as intuitive as it could be. This PR aims to help fix that problem.

  • add the extension's name and logo
  • add more consistency to font sizes and spacing values
  • make "white list" feature's behavior clearer
    I think, after spending time with the UI during this PR, that this is out of scope. It deserves a PR of its own.
  • make custom input usage clearer

This is currently a work-in-progress. I still need to review open issues to see if this PR can address those any of those as well.

@postrad postrad added the 🚀 feat A new feature! label May 25, 2020
@@ -8,7 +8,8 @@ import {
import { act } from 'react-dom/test-utils';

import * as chromeHelpers from '../../helpers/chrome';
import Popup, { colors } from '../popup';
import { COLORS } from '../../constants/colors';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the app caps constant.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed 👍

onChange={(e) => setColor(e.target.value)}
/>
<button type="submit">Save</button>
<label className="customForm--label">enter hexadecimal value</label>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: get the for and id hooked up for the input.

}

getActiveColorEffect();
}, []);

return (
<div className="colorLinks">
<span
<h1
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preserve the nice visual indicator for the current color, but also let's remind users what extension they're using.

</div>

{showCustomInput && <CustomInput color={activeColor} saveHandler={onColorChange} />}
<details>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to refactor (remove?) the hook logic, since the sweet new <details> element makes this easy.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that is 🔥


/* variables
_________________________________________________________*/
:root {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to use css custom properties for all the color logic. Setting and getting them in a Chrome extension has proven a little more elusive than I expected. But this will at least help consolidate our style values.

@postrad postrad requested a review from therynamo May 25, 2020 20:26
@@ -8,7 +8,8 @@ import {
import { act } from 'react-dom/test-utils';

import * as chromeHelpers from '../../helpers/chrome';
import Popup, { colors } from '../popup';
import { COLORS } from '../../constants/colors';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed 👍

</div>

{showCustomInput && <CustomInput color={activeColor} saveHandler={onColorChange} />}
<details>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that is 🔥

@@ -0,0 +1,2 @@

export const COLORS: Array<string> = ['#37d67a', '#2ccce4', '#06A77D', '#ff8a65', '#1E91D6']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can turn prefer default export out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know, I don't mind named imports. What do you think?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer them, to be honest. LETS BREAK THEM DOWN!

expect(customForm.length).toEqual(0);
});

it('should show custom input when no active color found', async () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Active color always exists, so I removed this test.


expect(colorButtons[0]).toHaveClass('colorLinks--button active');
expect(whiteList.length).toEqual(1);
expect(customForm.length).toEqual(0);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom form exists in the DOM now, even when it isn't visible.

await waitFor(() => expect(customForm.length).toEqual(1), { container });
});

it('should show a custom input when the custom color button is clicked', async () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This functionality no longer exists.

@@ -9,7 +9,7 @@ interface OwnProps {
const ColorButton: FC<OwnProps> = ({ color, clickHandler, active }) => (
<div>
<button
aria-label="save color"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need an aria-label, since this is clearly an extension that assists people who can see, and this label would only benefit screen reader users.

'comma-dangle': 'off',
'implicit-arrow-linebreak': 'off',
'import/prefer-default-export': 'off',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sortin things alphabetically

Copy link
Collaborator Author

@postrad postrad Jun 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we prefer named imports 😄

@coveralls
Copy link

coveralls commented Jun 20, 2020

Pull Request Test Coverage Report for Build 143157397

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.3%) to 92.806%

Files with Coverage Reduction New Missed Lines %
src/components/popup.tsx 1 93.75%
Totals Coverage Status
Change from base Build 132399733: -0.3%
Covered Lines: 108
Relevant Lines: 114

💛 - Coveralls

@@ -16,6 +16,7 @@ module.exports = {
'comma-dangle': 'off',
'implicit-arrow-linebreak': 'off',
'import/prefer-default-export': 'off',
'jsx-a11y/control-has-associated-label': 'off',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule seems unnecessary to enforce since screen reader support doesn't seem necessary.

@postrad postrad marked this pull request as ready for review June 20, 2020 01:57
@therynamo
Copy link
Owner

Wow @postrad, these are some really awesome upgrades! I love the new UI tweaks too.

I did see one "bug" (if you will), where submitting a custom color would not "save", and wouldn't display "current color".

Here is a gif:
Jun-23-2020 17-56-43

Also, do you think it'd be helpful to support both # and omission of the # in "custom color"?

@therynamo therynamo added this to In Progress in Color Links Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 feat A new feature!
Projects
Color Links
In Progress
Development

Successfully merging this pull request may close these issues.

None yet

3 participants