🎨 precharge les images du moteur en blob
Ce, afin de ne pas à avoir à gérer les fichiers importés. Ceci étant dit, c'est une solution temporaire. Dans le futur, il faudrait plutôt se baser sur les balise og des sourcespull/1052/head
parent
7f19d4c82f
commit
c6459f6d3c
|
@ -91,7 +91,7 @@
|
|||
"style-loader": "^0.23.1",
|
||||
"toml-loader": "^1.0.0",
|
||||
"typescript": "^3.9.2",
|
||||
"url-loader": "^1.0.1",
|
||||
"url-loader": "^4.1.0",
|
||||
"webpack": "^4.42.0",
|
||||
"webpack-bundle-analyzer": "^3.7.0",
|
||||
"webpack-cli": "^3.1.2",
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
import references from './références/références.yaml'
|
||||
import { toPairs } from 'ramda'
|
||||
import React from 'react'
|
||||
import { capitalise0 } from '../../utils'
|
||||
import styled from 'styled-components'
|
||||
|
||||
const references = {
|
||||
'service-public.fr': require('url-loader!./références/marianne.png').default,
|
||||
'urssaf.fr': require('url-loader!./références/URSSAF.png').default,
|
||||
'gouv.fr': require('url-loader!./références/marianne.png').default,
|
||||
'agirc-arrco.fr': require('url-loader!./références/agirc-arrco.png').default,
|
||||
'pole-emploi.fr': require('url-loader!./références/pole-emploi.png').default,
|
||||
'ladocumentationfrançaise.fr': require('url-loader!./références/ladocumentationfrançaise.png')
|
||||
.default,
|
||||
'senat.fr': require('url-loader!./références/senat.png').default,
|
||||
'ameli.fr': require('url-loader!./références/ameli.png').default,
|
||||
'bpifrance-creation': require('url-loader!./références/bpi-création.png')
|
||||
.default
|
||||
}
|
||||
|
||||
const findRefKey = (link: string) =>
|
||||
Object.keys(references).find(r => link.includes(r))
|
||||
|
||||
|
@ -20,20 +33,17 @@ type RefProps = {
|
|||
|
||||
function Ref({ name, link }: RefProps) {
|
||||
const refKey = findRefKey(link),
|
||||
refData = (refKey && references[refKey]) || {},
|
||||
domain = cleanDomain(link)
|
||||
return (
|
||||
<li
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'baseline'
|
||||
alignItems: 'center'
|
||||
}}
|
||||
key={name}
|
||||
>
|
||||
<span className="imageWrapper">
|
||||
{refData.image && (
|
||||
<img src={require('./références/' + refData.image)} />
|
||||
)}
|
||||
{refKey && <img src={references[refKey]} />}
|
||||
</span>
|
||||
<a
|
||||
href={link}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 3.3 KiB |
|
@ -1,23 +0,0 @@
|
|||
# Association d'URL de référence avec leur logo
|
||||
# Ces sources sont considérées comme officielles.
|
||||
|
||||
service-public.fr:
|
||||
image: marianne.png
|
||||
urssaf.fr:
|
||||
image: URSSAF.png
|
||||
gouv.fr:
|
||||
image: marianne.png
|
||||
agirc-arrco.fr:
|
||||
image: agirc-arrco.png
|
||||
pole-emploi.fr:
|
||||
image: pole-emploi.png
|
||||
ladocumentationfrançaise.fr:
|
||||
image: ladocumentationfrançaise.png
|
||||
senat.fr:
|
||||
image: senat.png
|
||||
ameli.fr:
|
||||
image: ameli.png
|
||||
bpifrance-creation:
|
||||
image: bpi-création.png
|
||||
wikipedia.org:
|
||||
image: wikipedia.png
|
Binary file not shown.
Before Width: | Height: | Size: 46 KiB |
|
@ -10,7 +10,7 @@ const common = {
|
|||
mode: 'development',
|
||||
entry: path.resolve(__dirname, 'source', 'index.ts'),
|
||||
module: {
|
||||
rules: commonLoaders()
|
||||
rules: commonLoaders({ file: false })
|
||||
},
|
||||
externals:
|
||||
// Every non-relative module is external
|
||||
|
|
|
@ -17,7 +17,7 @@ module.exports.styleLoader = styleLoader => ({
|
|||
]
|
||||
})
|
||||
|
||||
module.exports.commonLoaders = ({ legacy = false } = {}) => {
|
||||
module.exports.commonLoaders = ({ legacy = false, file = true } = {}) => {
|
||||
const babelLoader = {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
|
@ -49,15 +49,22 @@ module.exports.commonLoaders = ({ legacy = false } = {}) => {
|
|||
use: babelLoader,
|
||||
exclude: /node_modules|dist/
|
||||
},
|
||||
{
|
||||
test: /\.(jpe?g|png|svg)$/,
|
||||
use: {
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: 'images/[name].[ext]'
|
||||
}
|
||||
}
|
||||
},
|
||||
...(file
|
||||
? [
|
||||
{
|
||||
test: /\.(jpe?g|png|svg)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 8192,
|
||||
name: 'images/[name].[ext]'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
test: /\.yaml$/,
|
||||
use: ['json-loader', 'yaml-loader']
|
||||
|
|
25
yarn.lock
25
yarn.lock
|
@ -7281,6 +7281,15 @@ loader-utils@^1.0.0, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2
|
|||
emojis-list "^3.0.0"
|
||||
json5 "^1.0.1"
|
||||
|
||||
loader-utils@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
|
||||
integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==
|
||||
dependencies:
|
||||
big.js "^5.2.2"
|
||||
emojis-list "^3.0.0"
|
||||
json5 "^2.1.2"
|
||||
|
||||
locate-path@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
|
||||
|
@ -7627,7 +7636,7 @@ mime-types@2.1.18:
|
|||
dependencies:
|
||||
mime-db "~1.33.0"
|
||||
|
||||
mime-types@^2.1.12, mime-types@~2.1.19, mime-types@~2.1.24:
|
||||
mime-types@^2.1.12, mime-types@^2.1.26, mime-types@~2.1.19, mime-types@~2.1.24:
|
||||
version "2.1.27"
|
||||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f"
|
||||
integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==
|
||||
|
@ -11599,14 +11608,14 @@ url-join@^2.0.5:
|
|||
resolved "https://registry.yarnpkg.com/url-join/-/url-join-2.0.5.tgz#5af22f18c052a000a48d7b82c5e9c2e2feeda728"
|
||||
integrity sha1-WvIvGMBSoACkjXuCxenC4v7tpyg=
|
||||
|
||||
url-loader@^1.0.1:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-1.1.2.tgz#b971d191b83af693c5e3fea4064be9e1f2d7f8d8"
|
||||
integrity sha512-dXHkKmw8FhPqu8asTc1puBfe3TehOCo2+RmOOev5suNCIYBcT626kxiWg1NBVkwc4rO8BGa7gP70W7VXuqHrjg==
|
||||
url-loader@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-4.1.0.tgz#c7d6b0d6b0fccd51ab3ffc58a78d32b8d89a7be2"
|
||||
integrity sha512-IzgAAIC8wRrg6NYkFIJY09vtktQcsvU8V6HhtQj9PTefbYImzLB1hufqo4m+RyM5N3mLx5BqJKccgxJS+W3kqw==
|
||||
dependencies:
|
||||
loader-utils "^1.1.0"
|
||||
mime "^2.0.3"
|
||||
schema-utils "^1.0.0"
|
||||
loader-utils "^2.0.0"
|
||||
mime-types "^2.1.26"
|
||||
schema-utils "^2.6.5"
|
||||
|
||||
url@0.11.0, url@^0.11.0:
|
||||
version "0.11.0"
|
||||
|
|
Loading…
Reference in New Issue