Code Monkey home page Code Monkey logo

google-io-2021-workshop_user-adaptive-interfaces's Introduction

Welcome

This repository is a branch by branch walk through of this Google IO 2021 Workshop

Getting Started

Vite is the tool used in this project. Have node.js (v12 or newer) installed and run the following commands:

npm install
npm start

The command line will show you where to visit the running project, and enjoy live CSS and JS reloading.

google-io-2021-workshop_user-adaptive-interfaces's People

Contributors

argyleink avatar daviddotcs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

google-io-2021-workshop_user-adaptive-interfaces's Issues

Consider adding explicit sizes to <svg>

Currently icons are styled with external styles:

<!-- index.html -->
<svg viewBox="0 0 24 24">
  <title>A note icon</title>
  <path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/>
</svg>
/* index.css */
.fieldset-item svg {
  fill: var(--text2);
  block-size: var(--space-md);
}

Screenshot 2021-06-05 at 01 17 49

Unfortunately in some situations browsers give up on styles and fallback to HTML, it happens to me from time to time on cellular networks. Also Firefox has a tendency to flash unstyled markup just for a fraction of a second. And those huge black icons look so much worse than this:

image

You just need a couple of attributes. 16px * 2rem equals 32px, I guess:

<svg viewBox="0 0 24 24" width="32" height="32">
  <title>A note icon</title>
  <path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/>
</svg>

Consider using relative paths for wider audience

Currently you have absolute paths for both favicon and styles:

<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" href="/style.css">

And it works totally fine when you clone or download repository, install dependencies and run the server.

But if you just want to download the source code and play with it locally without running the server (you might not have Node.js installed or have outdated version) you just can’t. That’s what I actually did and it got me frustrated for a few moments.

Absolute paths stop you from seeing the demo right away. But if you change paths to relative:

<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="style.css">

…it start working in both cases. You can just double-click the index.html and look at the demo or spin up the server to enjoy live-reload, whichever you prefer.

I think this might open this or any future demos for a wider audience. Especially, beginners.

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.