mirror of
https://github.com/makeplane/plane.git
synced 2025-12-21 22:29:36 +01:00
* chore: detailed and simple empty state component added * chore: section empty state component added * chore: asset path helper hook added
18 lines
512 B
TypeScript
18 lines
512 B
TypeScript
import { useTheme } from "next-themes";
|
|
|
|
type AssetPathConfig = {
|
|
basePath: string;
|
|
additionalPath?: string;
|
|
extension?: string;
|
|
};
|
|
|
|
export const useResolvedAssetPath = ({ basePath, additionalPath = "", extension = "webp" }: AssetPathConfig) => {
|
|
// hooks
|
|
const { resolvedTheme } = useTheme();
|
|
|
|
// resolved theme
|
|
const theme = resolvedTheme === "light" ? "light" : "dark";
|
|
|
|
return `${additionalPath && additionalPath !== "" ? `${basePath}${additionalPath}` : basePath}-${theme}.${extension}`;
|
|
};
|