GithubHelp home page GithubHelp logo

darkwool / restaurant-page Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 617 KB

Simple restaurant page made with webpack for The Odin Project.

Home Page: https://darkwool.github.io/restaurant-page/

JavaScript 100.00%
the-odin-project restaurant-page webpack javascript css odin-project

restaurant-page's Introduction

Restaurant Page Project, view live

This was a project made for The Odin Project curriculum, our goal for this one was to make use of webpack and to generate all the pages dynamically with Javascript using modules.

Specifications

  1. Set up an HTML skeleton inside of dist/index.html with single <div id="content">.

  2. Create a bare-bones homepage for a restaurant. Include an image, headline, and some copy about how wonderful the restaurant is. It’s okay to hard-code these into the HTML for now just to see how they look on the page.

  3. Now remove those elements from the HTML (so leave only the <html>, <body>, and <div id="content"> tags) and instead create them by using JavaScript only, e.g. by appending each new element to div#content once the page is first loaded. Since we’re all set up to write our code in multiple files, let’s write this initial page-load function inside of its own module and then import and call it inside of index.js.

  4. Next, set up your restaurant site to use tabbed browsing to access the Contact and Menu pages.

    1. Put the contents of each ‘tab’ inside of its own module. Each module will export a function that creates a div element, adds the appropriate content and styles to that element and then appends it to the DOM.
    2. Write the tab-switching logic inside of index.js. You should have event listeners for each tab that wipes out the current contents and then runs the correct ‘tab module’ to populate it again.

Check the original page of the assignment here.

Things that I learned / put in practice:

  1. Differences between innerHTML and textContent.
  2. How to use modules in Javascript.
  3. Useful methods to append, remove, clone nodes.
  4. How to dynamically generate the entire contents of a page.
  5. This was my first time using webpack, learned a lot of things with this!
  6. How to use and why a document fragment is a good idea.

Credits

  1. Coffee shop hero image: Photo by Sebastian Schuppik on Unsplash.
  2. Coffee Cup image: PikWizard.
  3. Ornament image: Curls vector created by macrovector - www.freepik.com

restaurant-page's People

Contributors

darkwool avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.