mirror of
https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git
synced 2026-08-06 12:58:57 +00:00
Click any StyleCard to open a full-screen modal showing the style applied to 9 interactive phone UI controls (buttons, inputs, toggles, checkboxes, radios, cards, badges, slider, nav bar) inside an iPhone mockup frame. Co-authored-by: yongtang <jlinux@msn.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import { StyleData } from "./types";
|
|
|
|
export interface Filters {
|
|
search: string;
|
|
type: string;
|
|
complexity: string;
|
|
era: string;
|
|
}
|
|
|
|
export const DEFAULT_FILTERS: Filters = {
|
|
search: "",
|
|
type: "",
|
|
complexity: "",
|
|
era: "",
|
|
};
|
|
|
|
export function getUniqueValues(
|
|
styles: StyleData[],
|
|
key: keyof StyleData
|
|
): string[] {
|
|
const set = new Set<string>();
|
|
for (const s of styles) {
|
|
const val = String(s[key]).trim();
|
|
if (val) set.add(val);
|
|
}
|
|
return Array.from(set).sort();
|
|
}
|
|
|
|
export function filterStyles(
|
|
styles: StyleData[],
|
|
filters: Filters
|
|
): StyleData[] {
|
|
return styles.filter((s) => {
|
|
if (filters.type && s.type !== filters.type) return false;
|
|
if (filters.complexity && s.complexity !== filters.complexity) return false;
|
|
if (filters.era && s.eraOrigin !== filters.era) return false;
|
|
|
|
if (filters.search) {
|
|
const q = filters.search.toLowerCase();
|
|
const searchable = [
|
|
s.styleCategory,
|
|
s.keywords,
|
|
s.bestFor,
|
|
s.eraOrigin,
|
|
s.type,
|
|
s.complexity,
|
|
]
|
|
.join(" ")
|
|
.toLowerCase();
|
|
if (!searchable.includes(q)) return false;
|
|
}
|
|
|
|
return true;
|
|
});
|
|
}
|