当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript styleUtils.variableFactory函数代码示例

本文整理汇总了TypeScript中@library/styles/styleUtils.variableFactory函数的典型用法代码示例。如果您正苦于以下问题:TypeScript variableFactory函数的具体用法?TypeScript variableFactory怎么用?TypeScript variableFactory使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了variableFactory函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: useThemeCache

export const containerVariables = useThemeCache(() => {
    const vars = layoutVariables();
    const globalVars = globalVariables();
    const makeThemeVars = variableFactory("containerVariables");

    const spacing = makeThemeVars("spacing", {
        padding: {
            horizontal: vars.gutter.size,
        },
    });

    const sizing = makeThemeVars("sizes", {
        full: vars.contentSizes.full,
        narrowContentSize: vars.contentSizes.narrow,
    });

    const colors = makeThemeVars("colors", {
        bg: globalVars.mainColors.bg,
    });

    return {
        sizing,
        colors,
        spacing,
    };
});
开发者ID:vanilla,项目名称:vanilla,代码行数:26,代码来源:containerStyles.ts

示例2: useThemeCache

export const siteNavVariables = useThemeCache(() => {
    const globalVars = globalVariables();
    const makeThemeVars = variableFactory("siteNav");

    const node = makeThemeVars("node", {
        fontSize: globalVars.fonts.size.medium,
        fg: globalVars.mainColors.fg,
        lineHeight: globalVars.lineHeights.condensed,
        borderWidth: 1,
        padding: 4,
        active: {
            fg: globalVars.links.colors.default,
            fontWeight: globalVars.fonts.weights.bold,
        },
    });

    const title = makeThemeVars("title", {
        fontSize: globalVars.fonts.size.large,
        fontWeight: globalVars.fonts.weights.bold,
    });

    const nodeToggle = makeThemeVars("nodeToggle", {
        height: node.fontSize * node.lineHeight,
        width: globalVars.gutter.size,
        iconWidth: 7,
    });

    const spacer = makeThemeVars("spacer", {
        default: 7,
    });

    return { node, title, nodeToggle, spacer };
});
开发者ID:vanilla,项目名称:vanilla,代码行数:33,代码来源:siteNavStyles.ts

示例3: useThemeCache

export const panelListVariables = useThemeCache(() => {
    const globalVals = globalVariables();
    const makeThemeVars = variableFactory("panelList");

    const title = makeThemeVars("title", {
        fontSize: globalVals.fonts.size.large,
    });
    const offset = makeThemeVars("offset", {
        default: 12,
    });
    const link = makeThemeVars("link", {
        fontSize: globalVals.fonts.size.medium,
        hover: {
            color: globalVals.links.colors.default,
        },
        focus: {
            color: globalVals.links.colors.focus,
        },
    });
    return {
        title,
        offset,
        link,
    };
});
开发者ID:vanilla,项目名称:vanilla,代码行数:25,代码来源:panelListStyles.ts

示例4: useThemeCache

export const loaderVariables = useThemeCache(() => {
    const globalVars = globalVariables();
    const makeThemeVars = variableFactory("loader");

    const colors = makeThemeVars("colors", {
        fg: globalVars.mainColors.primary,
    });

    const fullPage: ISpinnerProps = makeThemeVars("fullPage", {
        size: 100,
        thickness: 6,
        color: colors.fg,
    });

    const medium: ISpinnerProps = makeThemeVars("medium", {
        size: 50,
        thickness: 4,
        color: colors.fg,
    });

    const small: ISpinnerProps = makeThemeVars("small", {
        size: 36,
        thickness: 4,
        color: colors.fg,
    });

    return { fullPage, small, medium };
});
开发者ID:vanilla,项目名称:vanilla,代码行数:28,代码来源:loaderStyles.ts

示例5: useThemeCache

export const titleBarNavigationVariables = useThemeCache(() => {
    const makeThemeVars = variableFactory("titleBarNavigation");
    const globalVars = globalVariables();
    const varsFormElements = formElementsVariables();

    const border = makeThemeVars("border", {
        verticalWidth: 3,
    });

    const item = makeThemeVars("item", {
        size: varsFormElements.sizing.height,
    });

    const padding = makeThemeVars("padding", {
        horizontal: globalVars.gutter.half,
    });

    const linkActive = makeThemeVars("linkActive", {
        offset: 2,
        height: 3,
        bg: globalVars.mainColors.bg.fade(0.9),
        bottomSpace: 1,
    });

    return {
        border,
        item,
        linkActive,
        padding,
    };
});
开发者ID:vanilla,项目名称:vanilla,代码行数:31,代码来源:titleBarNavStyles.ts

示例6: useThemeCache

export const modalVariables = useThemeCache(() => {
    const globalVars = globalVariables();
    const makeThemeVars = variableFactory("modal");

    const { elementaryColors } = globalVars;

    const colors = makeThemeVars("colors", {
        fg: globalVars.mainColors.fg,
        bg: globalVars.mainColors.bg,
        overlayBg:
            globalVars.mainColors.fg.lightness() > 0.5
                ? elementaryColors.white.fade(0.4)
                : elementaryColors.black.fade(0.4),
    });

    const sizing = makeThemeVars("sizing", {
        large: 720,
        medium: 516,
        small: 375,
    });

    const spacing = makeThemeVars("spacing", {
        horizontalMargin: 16,
    });

    const border = makeThemeVars("border", {
        radius: globalVars.border.radius,
    });

    const dropDown = makeThemeVars("dropDown", {
        padding: globalVars.spacer.size,
    });

    const header = makeThemeVars("header", {
        minHeight: 60,
        verticalPadding: 12,
        boxShadow: `0 1px 2px 0 ${colorOut(globalVars.overlay.bg)}`,
    });

    const footer = makeThemeVars("footer", {
        minHeight: header.minHeight,
        verticalPadding: header.verticalPadding,
        boxShadow: `0 -1px 2px 0 ${colorOut(globalVars.overlay.bg)}`,
    });

    return {
        colors,
        sizing,
        spacing,
        border,
        dropDown,
        header,
        footer,
    };
});
开发者ID:vanilla,项目名称:vanilla,代码行数:55,代码来源:modalStyles.ts

示例7: useThemeCache

export const searchBarVariables = useThemeCache(() => {
    const globalVars = globalVariables();
    const formElementVars = formElementsVariables();
    const themeVars = variableFactory("searchBar");

    const search = themeVars("search", {
        minWidth: 109,
    });

    const sizing = themeVars("sizing", {
        height: 40,
    });

    const placeholder = themeVars("placeholder", {
        color: formElementVars.placeholder.color,
    });

    const heading = themeVars("heading", {
        margin: 5,
    });

    const border = themeVars("border", {
        radius: globalVars.border.radius,
        width: globalVars.border.width,
    });

    const input = themeVars("input", {
        fg: globalVars.mainColors.fg,
        bg: globalVars.mainColors.bg,
    });

    const searchIcon = themeVars("searchIcon", {
        gap: 32,
        height: 13,
        width: 13,
        fg: input.fg.fade(0.7),
    });

    const results = themeVars("results", {
        fg: globalVars.mainColors.fg,
        bg: globalVars.mainColors.bg,
    });

    return {
        search,
        searchIcon,
        sizing,
        placeholder,
        input,
        heading,
        results,
        border,
    };
});
开发者ID:vanilla,项目名称:vanilla,代码行数:54,代码来源:searchBarStyles.ts

示例8: useThemeCache

export const widgetVariables = useThemeCache(() => {
    const globalVars = globalVariables();
    const makeThemeVars = variableFactory("widget");

    const spacing = makeThemeVars("spacing", {
        inner: {
            verticalPadding: globalVars.gutter.half,
            horizontalPadding: globalVars.gutter.quarter,
        },
    });

    const section = makeThemeVars("section", {
        gap: globalVars.gutter.half,
    });

    const color = makeThemeVars("color", {
        bg: transparentColor,
        fg: globalVars.mainColors.fg,
    });

    const border = makeThemeVars("border", {
        color: globalVars.border.color,
        width: globalVars.border.width,
        radius: globalVars.border.radius,
    });

    const title = makeThemeVars("title", {
        size: globalVars.fonts.size.subTitle,
    });

    const subTitle = makeThemeVars("subTitle", {
        size: globalVars.fonts.size.large,
    });

    const text = makeThemeVars("text", {
        size: globalVars.fonts.size.medium,
    });

    const contents = makeThemeVars("contents", {
        bg: color.bg,
    });

    return {
        spacing,
        section,
        color,
        border,
        title,
        subTitle,
        text,
        contents,
    };
});
开发者ID:vanilla,项目名称:vanilla,代码行数:53,代码来源:widgetStyleVars.ts

示例9: useThemeCache

export const messagesVariables = useThemeCache(() => {
    const globalVars = globalVariables();
    const themeVars = variableFactory("messages");

    const sizing = themeVars("sizing", {
        minHeight: 54,
        width: 900, // only applies to "fixed" style
    });

    const spacing = themeVars("spacing", {
        padding: {
            vertical: 8,
            horizontal: 42,
        },
    });

    const colors = themeVars("colors", {
        fg: globalVars.feedbackColors.warning.fg,
        bg: globalVars.feedbackColors.warning.bg,
        states: {
            fg: globalVars.feedbackColors.warning.state,
        },
    });

    const text = themeVars("text", {
        font: {
            color: colors.fg,
            size: globalVars.fonts.size.medium,
            weight: globalVars.fonts.weights.semiBold as FontWeightProperty,
        },
    });

    const actionButton = themeVars("actionButton", {
        padding: {
            vertical: spacing.padding.vertical,
            horizontal: spacing.padding.horizontal / 2,
        },
        font: {
            size: globalVars.fonts.size.medium,
            weight: globalVars.fonts.weights.bold as FontWeightProperty,
        },
        minHeight: 36,
    });

    return {
        sizing,
        spacing,
        colors,
        text,
        actionButton,
    };
});
开发者ID:vanilla,项目名称:vanilla,代码行数:52,代码来源:messageStyles.ts

示例10: useThemeCache

export const subcommunityListVariables = useThemeCache(() => {
    const themeVars = variableFactory("subcommunityList");
    const spacing = themeVars("spacing", {
        padding: 24,
    });

    const sizing = themeVars("sizing", {
        columnWidth: "50%",
        columnsWidth: 912,
    });

    return { spacing, sizing };
});
开发者ID:vanilla,项目名称:vanilla,代码行数:13,代码来源:subcommunityListStyles.ts


注:本文中的@library/styles/styleUtils.variableFactory函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。