mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
feat(utils): add difficulty color utility and update type imports
This commit is contained in:
parent
192d882fdd
commit
25920fcb68
@ -1,6 +1,6 @@
|
|||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
import { clsx, type ClassValue } from "clsx";
|
import { clsx, type ClassValue } from "clsx";
|
||||||
import { EditorLanguageConfig } from "@prisma/client";
|
import type { EditorLanguageConfig, Difficulty } from "@prisma/client";
|
||||||
|
|
||||||
export function cn(...inputs: ClassValue[]) {
|
export function cn(...inputs: ClassValue[]) {
|
||||||
return twMerge(clsx(inputs));
|
return twMerge(clsx(inputs));
|
||||||
@ -12,3 +12,16 @@ export function getPath(
|
|||||||
) {
|
) {
|
||||||
return `file:///${problemId}/${editorLanguageConfig.fileName}${editorLanguageConfig.fileExtension}`;
|
return `file:///${problemId}/${editorLanguageConfig.fileName}${editorLanguageConfig.fileExtension}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getDifficultyColorClass = (difficulty: Difficulty) => {
|
||||||
|
switch (difficulty) {
|
||||||
|
case "EASY":
|
||||||
|
return "text-green-500";
|
||||||
|
case "MEDIUM":
|
||||||
|
return "text-yellow-500";
|
||||||
|
case "HARD":
|
||||||
|
return "text-red-500";
|
||||||
|
default:
|
||||||
|
return "text-gray-500";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user