Add view helper for colored badges

This commit is contained in:
Râu Cao
2023-02-25 15:28:02 +08:00
parent a0727e709f
commit e675970f4c
2 changed files with 17 additions and 1 deletions

View File

@@ -10,5 +10,12 @@ module ApplicationHelper
"text-gray-300 hover:bg-gray-900/30 hover:text-white active:bg-gray-900/30 active:text-white px-3 py-2 rounded-md font-medium text-base md:text-sm block md:inline-block"
end
end
# Colors available: gray, red, yellow, green, blue, purple, pink
# (Add more colors by adding classes to the safelist in tailwind.config.js)
def badge(text, color)
tag.span text, class: "inline-flex items-center rounded-full bg-#{color}-100 px-2.5 py-0.5 text-xs font-medium text-#{color}-800"
end
end