Skip to content

Commit c6996fa

Browse files
Alex Fuentesclaude
andcommitted
Add NutriScore as pre-cooked component in master
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1b76a32 commit c6996fa

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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; }
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { NutriScore } from './NutriScore'

0 commit comments

Comments
 (0)