Skip to content

Commit

Permalink
Merge pull request #570 from datagir/iconographie
Browse files Browse the repository at this point in the history
Iconographie
  • Loading branch information
laem committed Sep 6, 2022
2 parents 50535c7 + 7938c9b commit e2c8646
Show file tree
Hide file tree
Showing 47 changed files with 4,697 additions and 347 deletions.
39 changes: 39 additions & 0 deletions source/components/SafeCategoryImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { useState } from 'react'
import emoji from './emoji'

export default ({ element, whiteBackground = false }) => {
const [fail, setFail] = useState(false)
return (
<span
css={`
${!whiteBackground &&
`
img {
filter: grayscale(1) invert(1) brightness(${fail ? '7' : '1.8'});
}
`}
display: flex;
align-items: center;
justify-content: center;
img {
width: 2.5rem;
height: auto;
}
`}
>
{!fail ? (
<img
src={`/images/model/${element.dottedName}.svg`}
onError={({ currentTarget }) => {
currentTarget.onerror = null
setFail(true)
}}
/>
) : (
<img src={'/images/three-dots.svg'} />
)}
</span>
)
}
2 changes: 1 addition & 1 deletion source/components/SessionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const openmojis = {
action: 'E10C',
conference: '1F3DF',
sondage: '1F4CA',
profile: '1F464',
profile: 'silhouette',
personas: '1F465',
github: 'E045',
}
Expand Down
3 changes: 2 additions & 1 deletion source/components/conversation/AnswerList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useNavigate } from 'react-router-dom'
import { situationSelector } from 'Selectors/simulationSelectors'
import { answeredQuestionsSelector } from '../../selectors/simulationSelectors'
import { safeGetRule, splitName } from '../publicodesUtils'
import SafeCategoryImage from '../SafeCategoryImage'
import './AnswerList.css'
import AnswerTrajetsTable from './estimate/AnswerTrajetsTable'

Expand Down Expand Up @@ -199,7 +200,7 @@ const SubCategory = ({ rule, rules, engine, level }) => {
`}
`}
>
{emoji(rule.rawNode.icônes || '')}
<SafeCategoryImage element={rule} whiteBackground={level > 1} />
{level === 1 ? <h2>{rule.title}</h2> : <h3>{rule.title}</h3>}
<div css="margin-left: auto !important; > * {margin: 0 .4rem}; img {font-size: 100%}">
<small>
Expand Down
8 changes: 4 additions & 4 deletions source/components/conversation/CategoryRespiration.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { motion } from 'framer-motion'
import React, { useEffect, useRef } from 'react'
import emoji from 'react-easy-emoji'
import { useEffect, useRef } from 'react'
import SafeCategoryImage from '../SafeCategoryImage'
import useKeypress from '../utils/useKeyPress'

// Naive implementation - in reality would want to attach
Expand Down Expand Up @@ -60,7 +60,7 @@ export default ({ dismiss, questionCategory }) => {
font-weight: 300;
}
img {
font-size: 350%;
width: 5rem;
margin: 0.4rem;
}
button {
Expand Down Expand Up @@ -95,7 +95,7 @@ export default ({ dismiss, questionCategory }) => {
}}
>
<h2>{questionCategory.title}</h2>
{emoji(questionCategory.icons)}
<SafeCategoryImage element={questionCategory} />
<button className="ui__ plain button attention" onClick={dismiss}>
Commencer
</button>
Expand Down
264 changes: 18 additions & 246 deletions source/images/climate-change-small.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
335 changes: 335 additions & 0 deletions source/images/climate-change-small.variations.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
170 changes: 170 additions & 0 deletions source/images/model/alimentation . boisson.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e2c8646

Please sign in to comment.