本文整理匯總了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,
};
});
示例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 };
});
示例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,
};
});
示例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 };
});
示例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,
};
});
示例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,
};
});
示例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,
};
});
示例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,
};
});
示例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,
};
});
示例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 };
});