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

add Notification Type to Snack Messaging #2884

Merged
merged 5 commits into from
Jan 23, 2023

Conversation

fabian-bizfactory
Copy link
Contributor

No description provided.

@fabian-bizfactory fabian-bizfactory self-assigned this Jan 16, 2023
@Kadrian
Copy link
Collaborator

Kadrian commented Jan 16, 2023

@fabian-bizfactory please let me know once you've looked through the diff and you think this is ready for review

@fabian-bizfactory fabian-bizfactory marked this pull request as draft January 16, 2023 15:35
@fabian-bizfactory
Copy link
Contributor Author

Sorry, about the PR pull. Found a potential issue after creating it

@fabian-bizfactory fabian-bizfactory marked this pull request as ready for review January 18, 2023 09:50
Copy link
Collaborator

@Kadrian Kadrian left a comment

Choose a reason for hiding this comment

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

Looks good overall, I've got a couple of suggestions, would be happy if you could take a look at those!

const resetMessage = () => dispatch(setMessage({ message: null }));
const resetMessage = () =>
dispatch(
setMessage({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use the resetMessage action instead here

@@ -4,12 +4,19 @@ import { Action } from "../app/actions";

import { resetMessage, setMessage } from "./actions";

export enum SnackMessageTypeT {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ending types with aT is something we're trying to slowly move away from, I'd suggest calling it SnackMessageType


const Root = styled("div")`
const colorLookupTable: { [key in SnackMessageTypeT]: string } = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's avoid calling variables by their "data structure" ("lookup table") and instead describe what they contain. Also Record is useful here:

Suggested change
const colorLookupTable: { [key in SnackMessageTypeT]: string } = {
const bgColorByType: Record<SnackMessageType, string> = {

export type SnackMessageActions = ActionType<
typeof setMessage | typeof resetMessage
>;

export const setMessage = createAction("snack-message/SET")<{
message: string | null;
notificationType: SnackMessageTypeT;
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about just calling it type?

Suggested change
notificationType: SnackMessageTypeT;
type: SnackMessageType;

const Root = styled("div")`
const colorLookupTable: { [key in SnackMessageTypeT]: string } = {
[SnackMessageTypeT.ERROR]: "rgba(0, 0, 0, 0.75)",
[SnackMessageTypeT.SUCCESS]: "rgba(12, 100, 39, 0.75)", // #0C6427
Copy link
Collaborator

Choose a reason for hiding this comment

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

Have you tested what it looks like? I think with the green, it's actually too transparent, how about using 0.9?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I liked it that way. Took a look at 0.9, you are right, that looks better

Copy link
Collaborator

@Kadrian Kadrian left a comment

Choose a reason for hiding this comment

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

Nice! Looks good to me

@fabian-bizfactory fabian-bizfactory merged commit d746269 into develop Jan 23, 2023
@delete-merged-branch delete-merged-branch bot deleted the feature/color-notfication branch January 23, 2023 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants