mns-mini-zabor/components/pattern.ts

12 lines
426 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export const patterns = [
{ name: 'Без узора', },
{ name: 'Узор 1', filename: 'tile1.png' },
{ name: 'А это узор 2', filename: 'tile2.jpg' },
]
export const getFilename = (name: patternTypes) => {
const el = patterns.find(el => el.name == name)
if (!el || !el.filename) return undefined
return `/pattern/${el?.filename}`
}
export type patternTypes = typeof patterns[number]['name']