The lesson focuses on migrating a previously created Badge recipe to a config recipe.
Create a new file named badge.recipe.ts
and move the existing Badge recipe into this file.
Replace cva
import with defineRecipe
from @pandacss/dev
import { defineRecipe } from '@pandacss/dev'
Add a className
to the recipe to resolve the TypeScript error.
className: 'badge'
Import the badge recipe into your panda.config
file
import { badgeRecipe } from './badge.recipe'
Add a recipes
property to the config and include the badge recipe:
recipes: {
badge: badgeRecipe
}
panda codegen
and restart the development serverThis creates a folder at styled-system/recipes
.
Import the badge recipe from styled-system/recipes
import { badge } from 'styled-system/recipes'
Replace existing badge recipe references with the new import.
Go ahead to compare the old and new recipes in the DOM for more readable classnames and grouped styles. import ts from 'typescript'