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

Pluggable cities assets #687

Merged
merged 8 commits into from Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 72 additions & 0 deletions README.md
Expand Up @@ -125,3 +125,75 @@ Create a file e.g. `my-custom-theme.scss` and apply style imports accordingly

Then change the `kerrokantasi-ui/src/index.js` style import from
`import '../assets/sass/kerrokantasi.scss';` to `import 'PATH-TO-YOUR-FILE/my-custom-theme.scss';`

## Using the whitelabel theme assets

To have a non city specific theme, change the `city_config` config to `whitelabel`

## Installing city specific assets

Currently the process of using the theme is not super developer friendly as it does
not support the use of `yarn link`. This means that to do development on the project
it will have to be installed in the kerrokantasi-ui project and then edited within
the kerrokantasi-ui `node_modules/<theme_assets>` folder. If someone can find
a solution to this, please fix.

Development steps:
0. Place the theme assets folder next to the `kerrokantasi-ui` folder
* The structure should look like this:
```
/
/kerrokantasi-ui
/<theme-assets-folder>
```
1. In the `kerrokantasi-ui` project run `yarn add ../<theme-assets-folder>`
2. Edit files in `kerrokantasi-ui/node_modules/<theme-assets-folder>` for changes to be reflected
3. Set the `city_config` config to <theme-assets-folder>


Production installation:
1. Add the project to the local `kerrokantasi-ui` project either by installing it
the same way as in the dev environment, or from GitHub or if the package is published
to npm, then install it from there.
2. Set the `city_config` config to <theme-assets-folder>

## Creating city specific assets

The assets of a city currently consists of the following things:
1. Styling
2. Favicons
3. Logos
4. Translation strings

An example of how a theme assets project could look like, either check out the `cities/helsinki`
folder in this project, or have a look already created theme assets such as:

https://github.com/City-of-Turku/kerrokantasi-ui-turku

### Aliases
The following aliases are available to use in SCSS and JS files:
* `kerrokantasi-ui`: Points to the root of this project
* `kerrokantasi-ui-modules`: Points to the node_modules of this project
* `@city-config`: Points to the root of the city specific assets
* `@city-assets`: Points to the assets folder in the city specific assets
* `@city-i18n`: Point to the i18n folder in the city specific assets
* `@@city-images`: Point to the image folder in the city specific assets

### Naming conventions
The following naming conventions needs to be used in order to city assets to
work.

* `/assets/app.scss`: The base style file that is imported
* `/i18n/[fi, sv, en].json`: Language files. If no string changes are to be made, only include `{}` in the files
* `/assets/images/logo[fi, sv]-black.svg`: Black/Dark site logo
* `/assets/images/logo[fi, sv]-white.svg`: White/Light site logo

#### Favicons:
The following favicons are recommended, but not mandatory to include.

* `/assets/favicon/favicon.ico`
* `/assets/favicon/favicon-32x32.png`
* `/assets/favicon/favicon-16x16.png`
* `/assets/favicon/manifest.json`
* `/assets/favicon/safari-pinned-tab.svg`
* `/assets/favicon/browserconfig.xml`
Binary file added assets/favicon/android-chrome-144x144.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/favicon/android-chrome-192x192.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/android-chrome-256x256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/android-chrome-36x36.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/android-chrome-384x384.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/android-chrome-48x48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/favicon/android-chrome-512x512.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/android-chrome-72x72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/android-chrome-96x96.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-1024x1024.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-114x114.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-120x120.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-144x144.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-152x152.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-167x167.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-180x180.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-57x57.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-60x60.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-72x72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-76x76.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon/apple-touch-icon-precomposed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/favicon/apple-touch-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions assets/favicon/browserconfig.xml
Expand Up @@ -2,8 +2,14 @@
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/assets/favicon/mstile-150x150.png"/>
<TileColor>#0072c6</TileColor>
<square70x70logo src="mstile-70x70.png"/>
<square150x150logo src="mstile-150x150.png"/>
<wide310x150logo src="mstile-310x150.png"/>
<square310x310logo src="mstile-310x310.png"/>
<TileColor>#fff</TileColor>

</tile>

</msapplication>

</browserconfig>
Binary file added assets/favicon/coast-228x228.png
Binary file modified assets/favicon/favicon-16x16.png
Binary file modified assets/favicon/favicon-32x32.png
Binary file modified assets/favicon/favicon.ico
Binary file not shown.
Binary file added assets/favicon/firefox_app_128x128.png
Binary file added assets/favicon/firefox_app_512x512.png
Binary file added assets/favicon/firefox_app_60x60.png
Binary file added assets/favicon/kerrokantasi-favicon.png
74 changes: 58 additions & 16 deletions assets/favicon/manifest.json
@@ -1,18 +1,60 @@
{
"name": "",
"icons": [
{
"src": "/assets/favicon/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/assets/favicon/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
"name": "Kerrokantasi",
"short_name": "Kerrokantasi",
"description": null,
"dir": "auto",
"lang": "fi-FI",
"display": "standalone",
"orientation": "any",
"scope": "/",
"start_url": "/",
"background_color": "#fff",
"theme_color": "#fff",
"icons": [
{
"src": "android-chrome-36x36.png",
"sizes": "36x36",
"type": "image/png"
},
{
"src": "android-chrome-48x48.png",
"sizes": "48x48",
"type": "image/png"
},
{
"src": "android-chrome-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "android-chrome-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "android-chrome-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "android-chrome-256x256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "android-chrome-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
14 changes: 14 additions & 0 deletions assets/favicon/manifest.webapp
@@ -0,0 +1,14 @@
{
"version": "1.0",
"name": "Kerrokantasi",
"description": null,
"icons": {
"60": "firefox_app_60x60.png",
"128": "firefox_app_128x128.png",
"512": "firefox_app_512x512.png"
},
"developer": {
"name": "City of Helsinki",
"url": "https://github.com/City-of-Helsinki"
}
}
Binary file modified assets/favicon/mstile-144x144.png
Binary file modified assets/favicon/mstile-150x150.png
Binary file modified assets/favicon/mstile-310x150.png
Binary file modified assets/favicon/mstile-310x310.png
Binary file modified assets/favicon/mstile-70x70.png
Binary file added assets/favicon/yandex-browser-50x50.png
9 changes: 9 additions & 0 deletions assets/favicon/yandex-browser-manifest.json
@@ -0,0 +1,9 @@
{
"version": "1.0",
"api_version": 1,
"layout": {
"logo": "yandex-browser-50x50.png",
"color": "#fff",
"show_title": true
}
}
1 change: 1 addition & 0 deletions assets/images/logo-fi-black.svg
1 change: 1 addition & 0 deletions assets/images/logo-fi-white.svg
1 change: 1 addition & 0 deletions assets/images/logo-sv-black.svg
1 change: 1 addition & 0 deletions assets/images/logo-sv-white.svg
36 changes: 18 additions & 18 deletions assets/sass/kerrokantasi/kerrokantasi.scss
Expand Up @@ -19,21 +19,21 @@
@import "~alertifyjs/build/css/alertify.css";

///// Kerrokantasi styles
@import "kerrokantasi/common";
@import "kerrokantasi/home";
@import "kerrokantasi/forms";
@import "kerrokantasi/navigation";
@import "kerrokantasi/hearing-page";
@import "kerrokantasi/hearing-list";
@import "kerrokantasi/hearing-form";
@import "kerrokantasi/footer";
@import "kerrokantasi/fullscreen-map-plugin";
@import "kerrokantasi/fullwidth-hearing";
@import "kerrokantasi/hearing-card";
@import "kerrokantasi/hearing-card-list";
@import "kerrokantasi/commentlist";
@import "kerrokantasi/alertify";
@import "kerrokantasi/carousel";
@import "kerrokantasi/question-page";
@import "kerrokantasi/hearing-attachment";
@import "kerrokantasi/hearing-languages";
@import "common";
@import "home";
@import "forms";
@import "navigation";
@import "hearing-page";
@import "hearing-list";
@import "hearing-form";
@import "footer";
@import "fullscreen-map-plugin";
@import "fullwidth-hearing";
@import "hearing-card";
@import "hearing-card-list";
@import "commentlist";
@import "alertify";
@import "carousel";
@import "question-page";
@import "hearing-attachment";
@import "hearing-languages";
Binary file added cities/helsinki/assets/favicon/apple-touch-icon.png
9 changes: 9 additions & 0 deletions cities/helsinki/assets/favicon/browserconfig.xml
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/assets/favicon/mstile-150x150.png"/>
<TileColor>#0072c6</TileColor>
</tile>
</msapplication>
</browserconfig>
Binary file added cities/helsinki/assets/favicon/favicon-16x16.png
Binary file added cities/helsinki/assets/favicon/favicon-32x32.png
Binary file added cities/helsinki/assets/favicon/favicon.ico
Binary file not shown.
18 changes: 18 additions & 0 deletions cities/helsinki/assets/favicon/manifest.json
@@ -0,0 +1,18 @@
{
"name": "",
"icons": [
{
"src": "/assets/favicon/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/assets/favicon/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
Binary file added cities/helsinki/assets/favicon/mstile-144x144.png
Binary file added cities/helsinki/assets/favicon/mstile-150x150.png
Binary file added cities/helsinki/assets/favicon/mstile-310x150.png
Binary file added cities/helsinki/assets/favicon/mstile-310x310.png
Binary file added cities/helsinki/assets/favicon/mstile-70x70.png
1 change: 1 addition & 0 deletions cities/helsinki/assets/images/default-image.svg
Binary file added cities/helsinki/assets/images/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions cities/helsinki/assets/images/logo-fi-black.svg
1 change: 1 addition & 0 deletions cities/helsinki/assets/images/logo-fi-white.svg
1 change: 1 addition & 0 deletions cities/helsinki/assets/images/logo-sv-black.svg
1 change: 1 addition & 0 deletions cities/helsinki/assets/images/logo-sv-white.svg