-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add text color to char sex column
Signed-off-by: Alexander Trost <galexrt@googlemail.com>
- Loading branch information
Showing
3 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
<script lang="ts" setup> | ||
import type { BadgeColor } from '#ui/types'; | ||
import { sexToColor, sexToIcon } from './helpers'; | ||
defineProps<{ | ||
sex: string; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<UBadge :color="sex === 'f' ? 'pink' : 'blue'" size="lg"> | ||
<UIcon :name="sex === 'f' ? 'i-mdi-gender-female' : 'i-mdi-gender-male'" /> | ||
<UBadge :color="sexToColor(sex) as BadgeColor" size="lg"> | ||
<UIcon :name="sexToIcon(sex)" /> | ||
</UBadge> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export function sexToColor(sex: string): string { | ||
if (sex === 'f') { | ||
return 'pink'; | ||
} else if (sex === 'm') { | ||
return 'blue'; | ||
} else if (sex === 'd') { | ||
return 'gray'; | ||
} | ||
|
||
return 'white'; | ||
} | ||
|
||
export function sexToTextColor(sex: string): string { | ||
if (sex === 'f') { | ||
return 'text-pink-300'; | ||
} else if (sex === 'm') { | ||
return 'text-blue-300'; | ||
} else if (sex === 'd') { | ||
return 'text-gray-300'; | ||
} | ||
|
||
return 'text-white-300'; | ||
} | ||
|
||
export function sexToIcon(sex: string): string { | ||
if (sex === 'f') { | ||
return 'i-mdi-gender-female'; | ||
} else if (sex === 'm') { | ||
return 'i-mdi-gender-male'; | ||
} | ||
|
||
return 'i-mdi-gender-non-binary'; | ||
} |