add favicon dev color

change favicon depending on USE_DEV_COLORS
This commit is contained in:
vchikalkin 2022-12-26 20:35:44 +03:00
parent 21ee102b0e
commit e7f7d5c336
19 changed files with 68 additions and 20 deletions

19
config/meta.jsx Normal file
View File

@ -0,0 +1,19 @@
/* eslint-disable import/prefer-default-export */
import getUrls from 'config/urls';
const { BASE_PATH } = getUrls();
function buildPath(filePath) {
return String.prototype.concat(BASE_PATH, filePath);
}
export const metaFavicon = (
<>
<link rel="apple-touch-icon" sizes="180x180" href={buildPath('/apple-touch-icon.png')} />
<link rel="icon" type="image/png" sizes="32x32" href={buildPath('/favicon-32x32.png')} />
<link rel="icon" type="image/png" sizes="16x16" href={buildPath('/favicon-16x16.png')} />
<link rel="manifest" href="/site.webmanifest" />
<link rel="mask-icon" href={buildPath('/safari-pinned-tab.svg')} color="#5bbad5" />
<meta name="theme-color" content="#ffffff" />
</>
);

View File

@ -12,9 +12,17 @@ const { serverRuntimeConfigSchema } = require('./config/schema/runtime-config');
const env = envSchema.parse(process.env);
const faviconSubPath = env.USE_DEV_COLORS ? '/favicon/dev' : '/favicon/prod';
function buildFaviconRewrite(source) {
return {
source,
destination: String.prototype.concat(env.BASE_PATH, faviconSubPath, source),
};
}
/** @type {import('next').NextConfig} */
const nextConfig = {
basePath: process.env.BASE_PATH,
basePath: env.BASE_PATH,
output: 'standalone',
swcMinify: true,
reactStrictMode: true,
@ -41,6 +49,12 @@ const nextConfig = {
source: urls.URL_CORE_FINGAP_PROXY,
destination: env.URL_CORE_FINGAP_DIRECT,
},
buildFaviconRewrite('/apple-touch-icon.png'),
buildFaviconRewrite('/favicon-32x32.png'),
buildFaviconRewrite('/favicon-16x16.png'),
buildFaviconRewrite('/android-chrome-192x192.png'),
buildFaviconRewrite('/android-chrome-512x512.png'),
buildFaviconRewrite('/safari-pinned-tab.svg'),
];
},
publicRuntimeConfig: publicRuntimeConfigSchema.parse(env),

View File

@ -1,9 +1,7 @@
import getUrls from 'config/urls';
import { metaFavicon } from 'config/meta';
import Document, { Head, Html, Main, NextScript } from 'next/document';
import { ServerStyleSheet } from 'styled-components';
const { BASE_PATH } = getUrls();
export default class MyDocument extends Document {
static async getInitialProps(ctx) {
const sheet = new ServerStyleSheet();
@ -38,13 +36,7 @@ export default class MyDocument extends Document {
<meta charSet="utf-8" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Лизинговый калькулятор Эволюция" />
<link rel="apple-touch-icon" sizes="180x180" href={`${BASE_PATH}/apple-touch-icon.png`} />
<link rel="icon" type="image/png" sizes="32x32" href={`${BASE_PATH}/favicon-32x32.png`} />
<link rel="icon" type="image/png" sizes="16x16" href={`${BASE_PATH}/favicon-16x16.png`} />
<link rel="manifest" href={`${BASE_PATH}/site.webmanifest`} />
<link rel="mask-icon" href={`${BASE_PATH}/safari-pinned-tab.svg`} color="#5bbad5" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" />
{metaFavicon}
</Head>
<body>
<Main />

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,32 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="789.000000pt" height="789.000000pt" viewBox="0 0 789.000000 789.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,789.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M3119 7886 c-2 -2 -47 -6 -99 -10 -440 -29 -955 -160 -1375 -349
-362 -164 -769 -429 -1038 -676 -20 -19 -51 -47 -69 -63 l-32 -28 25 -27 c37
-42 53 -58 224 -238 88 -92 175 -184 194 -204 18 -20 101 -108 185 -195 83
-87 159 -168 169 -180 10 -12 58 -62 107 -112 l87 -91 34 31 c869 811 2202
938 3217 305 224 -139 480 -365 636 -559 305 -382 481 -807 542 -1310 9 -71 9
-365 1 -452 -70 -706 -427 -1336 -999 -1764 -374 -279 -802 -448 -1288 -508
-111 -14 -522 -15 -595 -2 -16 3 -66 10 -110 16 -504 71 -1019 317 -1388 663
-43 40 -61 45 -74 23 -4 -8 -50 -59 -102 -113 -167 -175 -274 -287 -361 -379
-47 -49 -157 -166 -246 -259 -199 -210 -249 -265 -249 -275 0 -9 157 -149 265
-236 135 -109 321 -237 490 -336 96 -57 393 -208 407 -208 4 0 21 -7 36 -15
32 -16 233 -93 322 -123 309 -104 655 -174 986 -199 189 -14 662 -8 765 11 10
2 46 7 79 10 101 12 125 16 280 47 1512 300 2716 1413 3104 2869 35 131 72
306 85 400 2 19 8 58 11 85 4 28 9 61 11 75 26 160 25 669 -2 885 -6 49 -33
231 -40 271 -14 81 -79 334 -115 449 -402 1281 -1483 2296 -2814 2640 -225 58
-366 83 -645 116 -85 10 -612 23 -621 15z"/>
<path d="M3207 4984 c-309 -40 -582 -211 -749 -469 -118 -181 -169 -357 -169
-575 0 -348 173 -670 464 -864 492 -327 1152 -192 1472 303 72 112 116 220
151 376 12 52 13 308 2 365 -64 331 -254 592 -548 752 -181 98 -408 139 -623
112z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 941 B

After

Width:  |  Height:  |  Size: 941 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB