File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
src/components/nutri-score Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ .nutri-score {
2+ display : inline-flex;
3+ align-items : center;
4+ justify-content : center;
5+ padding : var (--spacing-xs ) var (--spacing-sm );
6+ border-radius : var (--border-radius-sm );
7+ font-size : var (--font-size-sm );
8+ font-weight : 700 ;
9+ color : var (--color-white );
10+ text-transform : uppercase;
11+ }
12+
13+ .nutri-score--a { background-color : # 038141 ; }
14+ .nutri-score--b { background-color : # 85bb2f ; }
15+ .nutri-score--c { background-color : # fecb02 ; color : var (--color-text ); }
16+ .nutri-score--d { background-color : # ee8100 ; }
17+ .nutri-score--e { background-color : # e63e11 ; }
Original file line number Diff line number Diff line change 1+ import classNames from 'classnames'
2+ import './NutriScore.css'
3+
4+ interface NutriScoreProps {
5+ score : string
6+ showLabel ?: boolean
7+ }
8+
9+ export const NutriScore = ( { score, showLabel = false } : NutriScoreProps ) => (
10+ < span
11+ className = { classNames ( 'nutri-score' , `nutri-score--${ score . toLowerCase ( ) } ` ) }
12+ >
13+ { showLabel && 'Nutriscore: ' }
14+ { score }
15+ </ span >
16+ )
Original file line number Diff line number Diff line change 1+ export { NutriScore } from './NutriScore'
You can’t perform that action at this time.
0 commit comments