Year #2, Week #8 đ» đșïž
New stuff we learned this week: đ€
Git upstream
and origin
remotes đĄ
- when creating a new git repo by cloning the source you cloned from is automatically named by git âoriginâ.
- when using a git workflow where you have forked a repo and cloned from the
FORK it is common to also add the original (non-fork) source repository as
an additional remote. The common convention to name this remote is
upstream
. - when changes from other collaborators are merged into the primary (non-fork)
repository, you can get those changes by pulling directly from
upstream
by runninggit pull upstream master
. - therefore, a common workflow would be, whenever you wanted to start a new batch of work on a repo, you would:
git checkout master
git pull upstream master # get the latest changes
# start your new work on top of latest changes
git checkout -b rad-new-feature
Useful Links:
Homework Plan
- 1 day review all flashcards (in your app)
- 1 day Flashcard App assignment
- 1-2 days Akron Snowmen assignment
- 2 day touch typing practice
- 4 days Execute Program homework
Flashcard App Homework
- merge your MR from last week
- pull down your changes into your local
master
branch - delete the old feature branch
- create a new feature branch for this week
- add two new cards into your
git
category (create it if you havenât already) forupstream
andorigin
remote names - add 20 more cards from your old physical (or digital) stack of flashcards
- commit your work
- add a feature to your flashcards app that allows you to visually see whether youâre viewing the front of a card, or the back. This could be a text label, a color, some other styling â whatever seems good to you.
- commit your work
- next, shrink the screen size that you normally view your flashcard app at until things start to looking bad. You donât have to get crazy small like for a phone, but just small enough to see where you current design starts to break down. Make some changes to your app so that things look better at that smaller screen size. You donât need to make everything perfect, just make it noticeably better than it was before. You might find you need media queries, but there also might be other ways to make the app look good at both sizes that donât require them. While youâre doing this, try to avoid over-complicating your code, or repeating yourself. Remember, youâre going to be building on this code for a long time. Take some time to clean things up if you spot opportunities for improvement in your code.
- commit your work.
- rebuild your flashcards app, and submit a MR. In the MR, tell me what screen size (in pixels) you worked on improving, so I can view it at that same size and see your work.
Akron Snowmen Assignment
- review ânew stuffâ above ^^
- connect to the project from vscode
- switch to master and retrieve the changes that were merged in during class
- create a new branch called
layout-attempt
. - create a new component called
<Layout />
that accepts atitle
prop of typestring
and the specialchildren
prop. The purpose of this component is to wrap all of the page âinnerdsâ with the stuff that will be on every page, like the logo, hamburger, horizontal nav, footer, and slideover menu. - the idea is that each page in the
pages/
dir will look something like this:
// ./pages/index.js
export default HomePage;
import React from "react";
import Layout from "../components/Layout";
const HomePage: React.FC = () => {
return (
<Layout title="Akron Snowmen">
<h1>Here is the homepage</h1>
<p>Here is some content for the homepage!</p>
</Layout>
);
};
export default HomePage;
- when itâs done, it should look about like this.
- here are some important hints and requirements:
- instead of working in Storybook, for this assignent weâll be building inside
of nextjs, like I was in class. So fire up your dev server with
npm run dev
and work that way. - youâre going to need to do some CSS and flexbox stuff to get the components
to work together and be laid out correctly. In order to do this, I do
not want you to edit the CSS of components themselves (like
Footer.module.css
). Instead, when you find that you want to add css to layout the components, wrap the component in a<div>
instead and apply styling to the div, using styles exported from aLayout.module.css
file. - hint: if you set the
width
prop of KiahâsLogo
component to193
it will be the same height as Winâs hamburger component. - hint: to get the footer to stick to the bottom of the page, make itâs
parent flex container set to
justify-content: flex-start
, but then addmargin-top: auto;
to the footer. This will make it stick to the bottom. However, because you want to obey what I said in point a) above, wrap the footer component in a div and set that div tomargin-top: auto;
- your Layout component will need to track one piece of state â whether or not the slideover menu is showing. This piece of state will control the prop passed to the Hamburger component, and it will show/hide the slideover component.
- to get the Slideover Menu showing and hiding like in my example, make an
outer wrapping div with
position: relative;
. Then make a wrapping div for the Slideover menu, and set that divâs width to300px
andposition: absolute
. Then give it astyle
prop that makes itdisplay: none
ordisplay: block
based on the one piece of state youâre tracking. - Winâs Hamburger component doesnât have an
onClick
prop yet. Thatâs OK. Instead of adding one, wrap his Hamburger in a div, and add anonClick
handler to the wrapping div. When clicked, it should change state to show the slideover menu. - Make another onClick handler on the div wrapping the SlideoverMenu component, when clicked, it should close the menu by toggling your one piece of state.
- instead of working in Storybook, for this assignent weâll be building inside
of nextjs, like I was in class. So fire up your dev server with
- when you finish, build your nextjs site by running
npm run build
(and you can view it athttp//:<yourname>.howtocomputer.link/akron-snowmen)
. Submit a MR and slack your website url and MR url. - this assignment is a bit tougher than it looks. reach out if you get stuck,
iâll give more hints, and I might at some point tell you that youâve done
enough and you can stop trying (thatâs why I told you to name the branch
layout-attempt
).