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

Make things pretty #67

Merged
merged 29 commits into from
Feb 9, 2020
Merged

Make things pretty #67

merged 29 commits into from
Feb 9, 2020

Conversation

prophen
Copy link
Contributor

@prophen prophen commented Feb 6, 2020

This PR addresses all of the styling issues #37, #38, #39, #40. We are going to make the app look pretty.

We agreed on using semantic UI for a component library. In the first commit of this branch Semantic has been imported and the NavTab menu was changed to use the Semantic menu.

Nikema Prophet added 18 commits February 5, 2020 17:35
Theming is set up so that when we decide on fonts, colors, and custom layouts we can update and/or override the default styles using less variables and css.
In an earlier commit I added a site header to App.js I removed it so that the welcome page for new lists can have it's own header. I changed some colors also just to play with it. I'm not married to any style choices I made we can still talk about final design choices.
Instead of making the welcome prompt two parts it's not just one view. The join list field and button are responsive.
I added a drop down with some placeholder data and moved the delete button to inside of it. Also, I took the popup off of the delete button action because it was behaving strangely on mobile.
All the pages have a basic level of styling. For usability I also added a delete item function on the shopping list view.

There was a problem where I was losing the token if the addItem screen was the entry to the app. It was because there was no communication with the list in context and we were using that list to check for duplicates.

To fix this I added a call to fetchList when addItem loads. Let me know if this breaks anything.
@prophen prophen marked this pull request as ready for review February 7, 2020 21:44
Copy link
Member

@segdeha segdeha left a comment

Choose a reason for hiding this comment

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

Just one requested change, everything else is suggestions!

Your switch statement looks like it will only work when the next expected purchase date is exactly 7, 14, or 30. Otherwise, this looks great!!!

@@ -24,7 +21,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Smart Shopping List - TCL3</title>
Copy link
Member

Choose a reason for hiding this comment

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

Nice job catching this detail!

"short_name": "React App",
"name": "Create React App Sample",
"short_name": "Smart Shopping List",
"name": "Smart Shopping List - Collab Lab Cohort 3",
Copy link
Member

Choose a reason for hiding this comment

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

Love that you took the time to tidy up these details!

src/components/ItemError.css Outdated Show resolved Hide resolved
@@ -16,9 +14,17 @@ const ListContextProvider = props => {
const [name, setName] = useState('');
const [shoppingList, setShoppingList] = useState([]);

// Should not be exposed in the API of this context
// This is super simple right now. A better version would have error handling backed into it
// as well as loading state management.
Copy link
Member

Choose a reason for hiding this comment

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

Love this comment! It leaves a breadcrumb for a future developer to make the app more resilient. Nice work!

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see now this was here before. Still, great comment! 😅

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 think @stevelikesmusic wrote this. I pasted this in from the other pull request. Somehow I lost those functions in the merge and the app was broken.

src/listContext.js Outdated Show resolved Hide resolved
src/listContext.js Outdated Show resolved Hide resolved
src/pages/JoinList.js Outdated Show resolved Hide resolved
};

switch (nextExpectedPurchase) {
case 7:
Copy link
Member

Choose a reason for hiding this comment

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

This works during testing because each item has the exact values. In practice, items will have values for this variable that are more like 7.342, 2.47, and 14.923 ... unless I'm misunderstanding, any value other than 7, 14, and 30 will result in the item getting the color white.

Instead, you could use a series of if statements, such as the following:

if (nextExpectedPurchase <= 7) {
    // set to colorCode.SOON
}
else if (nextExpectedPurchase <= 14) {
    // set to colorCode.KIND_OF_SOON
}}
else if (nextExpectedPurchase <= 30) {
    // set to colorCode.NOT_SOON
}}
else {
    // set to white
}}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed here 110f0bf

@@ -0,0 +1,3 @@
/*******************************
Site Overrides
Copy link
Member

Choose a reason for hiding this comment

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

Assuming these are Semantic-UI artifacts? Are they used to override styles of the built-in components? Sure are a lot of them... Is there a way to suppress them if they're not needed?

@prophen prophen requested a review from segdeha February 9, 2020 20:18
Copy link
Contributor

@ajiles91 ajiles91 left a comment

Choose a reason for hiding this comment

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

everything looks good locally

@mikeramz86
Copy link
Contributor

👍

return updateItem(item, purchase);
};

//we use .set to add the time the item was purchased to an already existing document we search for the item.id
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this function an be removed. We dropped it in the last PR in favor of purchaseItem

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 tried to remove it but it was called in purchaseItem


<Container textAlign="center" style={{ paddingBottom: 50 }}>
<Segment>
<div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this div?

<List>
<List.Item>
<List.Content>
<label>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason to not use 'Label` from semantic ui?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The semantic label is under the Form component and I didn't think to convert the forms to Form.

@@ -1,67 +1,17 @@
.container {
Copy link
Collaborator

Choose a reason for hiding this comment

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

❤️ deleting lots of code 😂

event.preventDefault();
saveToken(joinToken);

return joinToken && history.push('/list');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice use of history to redirect 👏

"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"start": "craco start",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this to allow overriding some of semantic ui's less styling?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the Semantic UI docs recommended craco so that the app doesn't eject when the less for the custom theme compiles. I'm not too familiar with that but that's how I understood it.

https://react.semantic-ui.com/theming/

@@ -1,4 +1,3 @@
//normalized function
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

I cleaned up a an unneeded div tag, removed some blank lines, and moved the updateItem function closer to purchaseItem in listContext.js.
@prophen prophen merged commit be4f12b into master Feb 9, 2020
@prophen prophen deleted the Add-styling branch February 9, 2020 22:20
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.

6 participants