File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 11<script setup>
22import MenuIcon from ' ./MenuIcon.vue'
33
4+ const toTitleCase = (str ) => {
5+ return str .toLowerCase ().replace (/ \b \w / g , (char ) => char .toUpperCase ());
6+ };
7+
8+ const normalizeTitle = (str ) => {
9+ return toTitleCase (str .replace (/ ^ [«»"] + | [«»"] + $ / g , ' ' ).trim ());
10+ };
11+
412const props = defineProps ({
513 name: {
614 type: String ,
@@ -49,7 +57,7 @@ const props = defineProps({
4957 <div :class =" compact ? '' : 'px-6 py-4 pb-6'" >
5058 <!-- Title row with vegi icon -->
5159 <div class =" flex items-center gap-2" >
52- <h3 :class =" ['capitalize', compact ? 'text-sm' : 'font-medium']" >{{ name }}</h3 >
60+ <h3 :class =" [compact ? 'text-sm' : 'font-medium']" >{{ normalizeTitle( name) }}</h3 >
5361 <span v-if =" type === 'vegetarian'" class =" text-green-600" >
5462 <svg xmlns =" http://www.w3.org/2000/svg" viewBox =" 0 0 24 24" fill =" none" stroke =" currentColor" :class =" compact ? 'size-3' : 'size-4'" stroke-width =" 1.5" stroke-linecap =" round" stroke-linejoin =" round" >
5563 <path d =" M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z" ></path ><path d =" M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12" ></path >
You can’t perform that action at this time.
0 commit comments