Skip to content

Commit

Permalink
Tweak visual design of figures, some naming, some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentSmedinga committed Apr 24, 2024
1 parent 1ad46ea commit b2af94a
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 87 deletions.
12 changes: 10 additions & 2 deletions storybook/config/preview-body.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<style>
.ams-docs-figure {
display: flex;
gap: 0.25rem;
margin: 0; /* stylelint-disable-line */
padding: 0; /* stylelint-disable-line */
}
Expand All @@ -8,12 +10,18 @@
.ams-docs-figure > img {
display: block;
max-width: 100%;
outline: 1px dashed #e8e8e8;
}

.ams-docs-figure > figcaption {
text-align: center;
}

.ams-docs-gallery {
align-items: flex-end;
display: flex;
align-items: center;
gap: 1em;
gap: 2rem;
margin-block: 1.5rem;
}

.ams-docs-gallery .ams-docs-figure {
Expand Down
7 changes: 6 additions & 1 deletion storybook/config/storybook-overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
.sbdocs-content.sbdocs-content > :is(ol, ul) li,
.sbdocs-content.sbdocs-content > div:not(.sb-unstyled) > :is(ol, ul) li,
.sbdocs-content.sbdocs-content > table:not(.sb-unstyled) :is(td, th),
.sbdocs-content.sbdocs-content > div:not(.sb-unstyled) > table:not(.sb-unstyled) :is(td, th) {
.sbdocs-content.sbdocs-content > div:not(.sb-unstyled) > table:not(.sb-unstyled) :is(td, th),
.sbdocs-content.sbdocs-content > div:not(.sb-unstyled) figcaption {
color: #000000;
font-family: "Amsterdam Sans", Arial, sans-serif;
}
Expand Down Expand Up @@ -103,4 +104,8 @@
font-size: 1rem;
}

.sbdocs-content.sbdocs-content > div:not(.sb-unstyled) figcaption {
font-size: 0.875rem;
}

/* stylelint-enable */
48 changes: 32 additions & 16 deletions storybook/src/docs/app-icon.docs.mdx
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
import { Meta } from "@storybook/blocks";
import { IcoFavicon, PngIconAppleTouch, PngIconsWebApp, SvgIconDefault } from "./components/AppIcons";
import { AppleTouchIcon, Favicon, SvgIcon, WebAppIcons } from "./components/AppIcons";

<Meta title="Docs/Assets/Favicon & App Icons" />

# Favicon & App Icons

Examples of all the assets needed to display a website icon (a favicon) in the web browser or publish a web app with the proper app names and icons. This set should cover all the combinations of common operating systems (Android, iOS, macOS, Windows) and browsers (Chrome, Safari, Edge, Firefox).
Represent the website in bookmarks, on home screens, in syndication and other tools.

Here’s how to display a website icon (a favicon) in the web browser or publish a web app with the proper app names and icons.
This set covers all combinations of common operating systems (Android, iOS, macOS, and Windows) and browsers (Chrome, Safari, Edge, and Firefox).

## Overview & examples

### Default SVG Icon
### Favicon

<Favicon />

<SvgIconDefault />
We include a classic icon file with this exact name as a baseline for some browsers and RSS readers.

```html
<link rel="icon" type="image/svg+xml" href="icon.svg" />
<link rel="icon" href="favicon.ico" sizes="16x16 32x32 64x64" />
```

### Favicon
### SVG Icon

Roughly 75% of browsers support SVG favicons, which are more efficient and versatile.

<IcoFavicon />
<SvgIcon />

```html
<link rel="icon" href="favicon.ico" sizes="16x16 32x32 64x64" />
<link rel="icon" type="image/svg+xml" href="icon.svg" />
```

### Apple Touch Icon

<PngIconAppleTouch />
<AppleTouchIcon />

An iPhone or iPad uses this image when adding the webpage as a shortcut to your home screen.

```html
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
```

### Web App Icons

<PngIconsWebApp />
<WebAppIcons />

Include `icons` object in `*.webmanifest` (see [Usage](#usage)):

Expand All @@ -56,7 +65,8 @@ Link the Web Manifest in the `<head>`:
<link rel="manifest" href="app.webmanifest" />
```

> Note: only include a Web Manifest if you want the website to be installable as a Progressive Web App (PWA). Browsers [may prompt the user to install the app](https://web.dev/learn/pwa/installation-prompt) on their device if a manifest is found.
> Note: only include a Web Manifest if you want the website to be installable as a Progressive Web App (PWA).
> Browsers [may prompt the user to install the app](https://web.dev/learn/pwa/installation-prompt) on their device if a manifest is found.
## Usage

Expand Down Expand Up @@ -89,13 +99,15 @@ sh node_modules/@amsterdam/design-system-assets/postinstall.sh "Full App Name" "

Users may then be prompted to install the app as a PWA.

> If an `index.html` is found in the root or in a `public` directory the script will also insert the links in the HTML's `<head>` tag. This will not be the case for Next.js applications.
> If an `index.html` is found in the root or in a `public` directory the script will also insert the links in the HTML's `<head>` tag.
> This will not be the case for Next.js applications.
> This script can work for any project that has an `index.html` file in the root or `public` directory.
### (B) Link manually

You can manually [symlink (symbolic link)](https://en.wikipedia.org/wiki/Symbolic_link#POSIX_and_Unix-like_operating_systems) and copy the files to the root or a `public` folder next to where the `index.html` is located in your project. An advantage of symlinking is that it tracks changes to the assets when there are package updates.
You can manually [symlink (symbolic link)](https://en.wikipedia.org/wiki/Symbolic_link#POSIX_and_Unix-like_operating_systems) and copy the files to the root or a `public` folder next to where the `index.html` is located in your project.
An advantage of symlinking is that it tracks changes to the assets when there are package updates.

Symlinking [the entire favicon directory](https://github.com/Amsterdam/design-system/tree/develop/proprietary/assets/favicon) and copying the [Web Manifest](https://github.com/Amsterdam/design-system/tree/develop/proprietary/assets/app.manifest) can be done as follows:

Expand All @@ -106,17 +118,21 @@ ln -s node_modules/@amsterdam/design-system-assets/favicon appicons
cp node_modules/@amsterdam/design-system-assets/manifest/app.webmanifest app.webmanifest
```

> Note: for the symlink, the last argument in the above command cannot be a path, but can only be the file or directory name. I.e. you need to be in the directory where you want to make the symbolic link.
> Note: for the symlink, the last argument in the above command cannot be a path, but can only be the file or directory name.
> I.e. you need to be in the directory where you want to make the symbolic link.
> Note that undoing a symlink can be done by simply removing the created file or directory link:
>
> ```sh
> rm -r appicons app.webmanifest
> ```
> Note: not all servers recognize the `.webmanifest` extension. See [Using a link element to link to a manifest on W3.org](https://www.w3.org/TR/appmanifest/#using-a-link-element-to-link-to-a-manifest) for more information.
> Note: not all servers recognize the `.webmanifest` extension.
> See [Using a link element to link to a manifest on W3.org](https://www.w3.org/TR/appmanifest/#using-a-link-element-to-link-to-a-manifest) for more information.
Make sure that the Web Manifest, stating the app's name and referencing the PNG icons, is available in the same location. Edit the `app.webmanifest` file to include the app's name and the icons you want to use. For example:
Make sure that the Web Manifest, stating the app's name and referencing the PNG icons, is available in the same location.
Edit the `app.webmanifest` file to include the app's name and the icons you want to use.
For example:
```json
{
Expand Down
113 changes: 45 additions & 68 deletions storybook/src/docs/components/AppIcons.tsx
Original file line number Diff line number Diff line change
@@ -1,72 +1,49 @@
import { Image, Paragraph } from '@amsterdam/design-system-react'
import { Image } from '@amsterdam/design-system-react'

export const IcoFavicon = () => {
return (
<div className="ams-docs-gallery">
<figure className="ams-docs-figure">
<Image src="favicon/favicon.ico" width={16} height={16} sizes="16x16" />
<figcaption>
<Paragraph>favicon.ico, 16x16px</Paragraph>
</figcaption>
</figure>
<figure className="ams-docs-figure">
<Image src="favicon/favicon.ico" width={32} height={32} sizes="32x32" />
<figcaption>
<Paragraph>favicon.ico, 32x32px</Paragraph>
</figcaption>
</figure>
<figure className="ams-docs-figure">
<Image src="favicon/favicon.ico" width={64} height={64} sizes="64x64" />
<figcaption>
<Paragraph>favicon.ico, 64x64px</Paragraph>
</figcaption>
</figure>
</div>
)
}
export const AppleTouchIcon = () => (
<div className="ams-docs-gallery">
<figure className="ams-docs-figure">
<Image src="favicon/apple-touch-icon.png" width={180} height={180} />
<figcaption>apple-touch-icon.png (180px)</figcaption>
</figure>
</div>
)

export const SvgIconDefault = () => {
return (
<div className="ams-docs-gallery">
<figure className="ams-docs-figure">
<Image src="favicon/icon.svg" width={64} height={64} />
<figcaption>
<Paragraph>icon.svg, 64x64px</Paragraph>
</figcaption>
</figure>
</div>
)
}
export const Favicon = () => (
<div className="ams-docs-gallery">
<figure className="ams-docs-figure">
<Image src="favicon/favicon.ico" width={16} height={16} />
<figcaption>favicon.ico (16px)</figcaption>
</figure>
<figure className="ams-docs-figure">
<Image src="favicon/favicon.ico" width={32} height={32} />
<figcaption>favicon.ico (32px)</figcaption>
</figure>
<figure className="ams-docs-figure">
<Image src="favicon/favicon.ico" width={64} height={64} />
<figcaption>favicon.ico (64px)</figcaption>
</figure>
</div>
)

export const PngIconAppleTouch = () => {
return (
<div className="ams-docs-gallery">
<figure className="ams-docs-figure">
<Image src="favicon/apple-touch-icon.png" width={180} height={180} />
<figcaption>
<Paragraph>apple-touch-icon.png, 180x180px</Paragraph>
</figcaption>
</figure>
</div>
)
}
export const SvgIcon = () => (
<div className="ams-docs-gallery">
<figure className="ams-docs-figure">
<Image src="favicon/icon.svg" width={64} height={64} />
<figcaption>icon.svg (64px)</figcaption>
</figure>
</div>
)

export const PngIconsWebApp = () => {
return (
<div className="ams-docs-gallery">
<figure className="ams-docs-figure">
<Image src="favicon/icon-192.png" width={192} height={192} />{' '}
<figcaption>
<Paragraph>icon-192.png, 192x192px</Paragraph>
</figcaption>
</figure>

<figure className="ams-docs-figure">
<Image src="favicon/icon-512.png" width={512} height={512} />{' '}
<figcaption>
<Paragraph>icon-512.png, 512x512px</Paragraph>
</figcaption>
</figure>
</div>
)
}
export const WebAppIcons = () => (
<div className="ams-docs-gallery">
<figure className="ams-docs-figure">
<Image src="favicon/icon-192.png" width={192} height={192} />
<figcaption>icon-192.png (192px)</figcaption>
</figure>
<figure className="ams-docs-figure">
<Image src="favicon/icon-512.png" width={512} height={512} />
<figcaption>icon-512.png (512px)</figcaption>
</figure>
</div>
)

0 comments on commit b2af94a

Please sign in to comment.