| 
 | 1 | +import { hidePropertiesIn, Problem, Properties } from "@mendix/pluggable-widgets-tools";  | 
 | 2 | +import {  | 
 | 3 | +    StructurePreviewProps,  | 
 | 4 | +    RowLayoutProps,  | 
 | 5 | +    ContainerProps,  | 
 | 6 | +    TextProps,  | 
 | 7 | +    structurePreviewPalette  | 
 | 8 | +} from "@mendix/widget-plugin-platform/preview/structure-preview-api";  | 
 | 9 | + | 
 | 10 | +export function getProperties(values: any, defaultValues: Properties): Properties {  | 
 | 11 | +    // No conditional properties for skiplink, but function provided for consistency  | 
 | 12 | +    return defaultValues;  | 
 | 13 | +}  | 
 | 14 | + | 
 | 15 | +export function check(values: any): Problem[] {  | 
 | 16 | +    const errors: Problem[] = [];  | 
 | 17 | +    if (!values.linkText) {  | 
 | 18 | +        errors.push({  | 
 | 19 | +            property: "linkText",  | 
 | 20 | +            message: "Link text is required"  | 
 | 21 | +        });  | 
 | 22 | +    }  | 
 | 23 | +    if (!values.mainContentId) {  | 
 | 24 | +        errors.push({  | 
 | 25 | +            property: "mainContentId",  | 
 | 26 | +            message: "Main content ID is required"  | 
 | 27 | +        });  | 
 | 28 | +    }  | 
 | 29 | +    return errors;  | 
 | 30 | +}  | 
 | 31 | + | 
 | 32 | +export function getPreview(values: any, isDarkMode: boolean): StructurePreviewProps | null {  | 
 | 33 | +    const palette = structurePreviewPalette[isDarkMode ? "dark" : "light"];  | 
 | 34 | +    const titleHeader: RowLayoutProps = {  | 
 | 35 | +        type: "RowLayout",  | 
 | 36 | +        columnSize: "grow",  | 
 | 37 | +        backgroundColor: palette.background.topbarStandard,  | 
 | 38 | +        borders: true,  | 
 | 39 | +        borderWidth: 1,  | 
 | 40 | +        children: [  | 
 | 41 | +            {  | 
 | 42 | +                type: "Container",  | 
 | 43 | +                padding: 4,  | 
 | 44 | +                children: [  | 
 | 45 | +                    {  | 
 | 46 | +                        type: "Text",  | 
 | 47 | +                        content: "SkipLink",  | 
 | 48 | +                        fontColor: palette.text.secondary  | 
 | 49 | +                    } as TextProps  | 
 | 50 | +                ]  | 
 | 51 | +            }  | 
 | 52 | +        ]  | 
 | 53 | +    };  | 
 | 54 | +    const linkContent: RowLayoutProps = {  | 
 | 55 | +        type: "RowLayout",  | 
 | 56 | +        columnSize: "grow",  | 
 | 57 | +        borders: true,  | 
 | 58 | +        padding: 0,  | 
 | 59 | +        children: [  | 
 | 60 | +            {  | 
 | 61 | +                type: "Container",  | 
 | 62 | +                padding: 6,  | 
 | 63 | +                children: [  | 
 | 64 | +                    {  | 
 | 65 | +                        type: "Text",  | 
 | 66 | +                        content: values.linkText || "Skip to main content",  | 
 | 67 | +                        fontSize: 14,  | 
 | 68 | +                        fontColor: palette.text.primary,  | 
 | 69 | +                        bold: true  | 
 | 70 | +                    } as TextProps  | 
 | 71 | +                ]  | 
 | 72 | +            }  | 
 | 73 | +        ]  | 
 | 74 | +    };  | 
 | 75 | +    return {  | 
 | 76 | +        type: "Container",  | 
 | 77 | +        borders: true,  | 
 | 78 | +        children: [titleHeader, linkContent]  | 
 | 79 | +    } as ContainerProps;  | 
 | 80 | +}  | 
0 commit comments