本文整理汇总了TypeScript中@library/styles/styleHelpers.flexHelper函数的典型用法代码示例。如果您正苦于以下问题:TypeScript flexHelper函数的具体用法?TypeScript flexHelper怎么用?TypeScript flexHelper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flexHelper函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: globalVariables
export const buttonLoaderClasses = (buttonType: ButtonTypes) => {
const globalVars = globalVariables();
const flexUtils = flexHelper();
const style = styleFactory("buttonLoader");
const buttonVars = buttonVariables();
let typeVars;
switch (buttonType) {
case ButtonTypes.PRIMARY:
typeVars = buttonVars.primary;
break;
default:
typeVars = buttonVars.standard;
break;
}
const root = style({
...flexUtils.middle(),
padding: unit(4),
height: percent(100),
width: percent(100),
$nest: {
"&:after": spinnerLoader({
color: typeVars.spinnerColor || (globalVars.mainColors.primary as any),
dimensions: 20,
}),
},
});
return { root };
};
开发者ID:vanilla,项目名称:vanilla,代码行数:30,代码来源:buttonStyles.ts
示例2: useThemeCache
export const loaderClasses = useThemeCache(() => {
const vars = loaderVariables();
const flex = flexHelper();
const style = styleFactory("loader");
const fullPageLoader = style("fullPageLoader", {
position: "fixed",
top: 0,
left: 0,
right: 0,
bottom: 0,
margin: "auto",
height: unit(vars.fullPage.size),
width: unit(vars.fullPage.size),
$nest: {
"&:after": {
...spinnerLoader(vars.fullPage),
},
},
});
const mediumLoader = style("mediumLoader", {
...absolutePosition.fullSizeOfParent(),
...flex.middle(),
height: percent(100),
width: percent(100),
$nest: {
"&:after": {
...spinnerLoader(vars.medium),
},
},
});
const smallLoader = style("smallLoader", {
...flex.middle(),
height: percent(46),
width: percent(46),
margin: "auto",
$nest: {
"&:after": {
...spinnerLoader(vars.small),
},
},
});
const loaderContainer = (size: TLength) => {
return style({
position: "relative",
display: "block",
margin: "auto",
height: unit(size),
width: unit(size),
});
};
return {
fullPageLoader,
mediumLoader,
smallLoader,
loaderContainer,
};
});
开发者ID:vanilla,项目名称:vanilla,代码行数:59,代码来源:loaderStyles.ts
示例3: useThemeCache
export const meBoxClasses = useThemeCache(() => {
const globalVars = globalVariables();
const formVars = formElementsVariables();
const titleBarVars = titleBarVariables();
const debug = debugHelper("meBox");
const mediaQueries = layoutVariables().mediaQueries();
const flex = flexHelper();
const style = styleFactory("meBox");
const root = style(
{
...debug.name(),
display: "flex",
alignItems: "center",
height: unit(titleBarVars.sizing.height),
},
mediaQueries.oneColumnDown({
height: unit(titleBarVars.sizing.mobile.height),
}),
);
const buttonContent = style("buttonContent", {
...flex.middle(),
width: unit(formVars.sizing.height),
maxWidth: unit(formVars.sizing.height),
flexBasis: unit(formVars.sizing.height),
height: unit(titleBarVars.meBox.sizing.buttonContents),
});
const rootFlexClass = (count: number) => {
return style("footFlexClass", {
flexBasis: unit(count * formElementsVariables().sizing.height),
});
};
return {
root,
buttonContent,
rootFlexClass,
};
});
开发者ID:vanilla,项目名称:vanilla,代码行数:41,代码来源:meBoxStyles.ts
示例4: titleBarNavClasses
export default function titleBarNavClasses() {
const globalVars = globalVariables();
const titleBarVars = titleBarVariables();
const vars = titleBarNavigationVariables();
const mediaQueries = layoutVariables().mediaQueries();
const flex = flexHelper();
const style = styleFactory("titleBarNav");
const root = style(
{
...flex.middleLeft(),
position: "relative",
height: unit(titleBarVars.sizing.height),
},
mediaQueries.oneColumnDown({
height: unit(titleBarVars.sizing.mobile.height),
}),
);
const navigation = style("navigation", {});
const items = style(
"items",
{
...flex.middleLeft(),
height: unit(titleBarVars.sizing.height),
...paddings(vars.padding),
},
mediaQueries.oneColumnDown({
height: px(titleBarVars.sizing.mobile.height),
justifyContent: "center",
width: percent(100),
}),
);
const link = style("link", {
...userSelect(),
color: colorOut(titleBarVars.colors.fg),
whiteSpace: "nowrap",
lineHeight: globalVars.lineHeights.condensed,
display: "flex",
alignItems: "center",
justifyContent: "center",
height: unit(vars.item.size),
textDecoration: "none",
$nest: {
"&.focus-visible": {
backgroundColor: colorOut(titleBarVars.buttonContents.state.bg),
},
"&:focus": {
backgroundColor: colorOut(titleBarVars.buttonContents.state.bg),
},
"&:hover": {
backgroundColor: colorOut(titleBarVars.buttonContents.state.bg),
},
},
});
const linkActive = style("linkActive", {
$nest: {
"&:after": {
...absolutePosition.topLeft(
`calc(50% - ${unit(vars.linkActive.height + vars.linkActive.bottomSpace)})`,
),
content: quote(""),
height: unit(vars.linkActive.height),
marginLeft: unit(negative(vars.linkActive.offset)),
width: calc(`100% + ${unit(vars.linkActive.offset * 2)}`),
backgroundColor: colorOut(vars.linkActive.bg),
transform: `translateY(${unit(titleBarVars.sizing.height / 2)})`,
},
},
});
const linkContent = style("linkContent", {
position: "relative",
});
const firstItem = style("lastItem", {
zIndex: 2,
});
const lastItem = style("lastItem", {
zIndex: 2,
});
return {
root,
navigation,
items,
link,
linkActive,
linkContent,
lastItem,
firstItem,
};
}
开发者ID:vanilla,项目名称:vanilla,代码行数:97,代码来源:titleBarNavStyles.ts
示例5: useThemeCache
export const compactMeBoxClasses = useThemeCache(() => {
const globalVars = globalVariables();
const vars = compactMeBoxVariables();
const style = styleFactory("compactMeBox");
const root = style({
display: "block",
});
const openButton = style("openButton", {
color: globalVars.elementaryColors.white.toString(),
});
const contents = style("contents", {
position: "relative",
height: percent(100),
});
const closeModal = style("closeModal", {
$nest: {
"&&": {
...absolutePosition.topRight(),
width: unit(vars.tab.width),
height: unit(vars.tab.height),
},
},
});
const tabList = style("tabList", sticky(), {
top: 0,
background: colorOut(vars.colors.bg),
zIndex: 2,
paddingRight: unit(vars.tab.width),
height: unit(vars.tab.height),
flexBasis: unit(vars.tab.width),
color: globalVars.mainColors.fg.toString(),
});
const tabButtonContent = style("tabButtonContent", {
...flexHelper().middle(),
position: "relative",
width: unit(vars.tab.width),
height: unit(vars.tab.height),
});
const tabPanels = style("tabPanels", {
height: calc(`100% - ${vars.tab.height}px`),
position: "relative",
});
const tabButton = style("tabButton", {
...flexHelper().middle(),
});
const panel = style("panel", {
maxHeight: percent(100),
borderTop: 0,
borderRadius: 0,
});
const body = style("body", {
flexGrow: 1,
});
const scrollContainer = style("scrollContainer", {
overflow: "auto",
});
return {
root,
openButton,
contents,
closeModal,
tabList,
tabPanels,
tabButton,
tabButtonContent,
panel,
body,
scrollContainer,
};
});
开发者ID:vanilla,项目名称:vanilla,代码行数:82,代码来源:compactMeBoxStyles.ts
示例6: useThemeCache
export const checkRadioClasses = useThemeCache(() => {
const globalVars = globalVariables();
const vars = checkRadioVariables();
const style = styleFactory("checkRadio");
const flexes = flexHelper();
//.radioButton,
//.checkbox
const root = style({
display: "flex",
flexWrap: "wrap",
alignItems: "center",
whiteSpace: "nowrap",
outline: 0,
$nest: {
"&.focus-accessible": {},
"&:hover": {
$nest: {
"& .radioButton-input:not([disabled]), & .checkbox-input:not([disabled])": {
$nest: {
"& + .radioButton-disk, & + .checkbox-box": {
borderColor: vars.main.hover.border.color.toString(),
opacity: vars.main.hover.opacity,
backgroundColor: vars.main.hover.bg.toString(),
},
},
},
"& .radioButton-disk, & .checkbox-box": {
backgroundColor: vars.main.hover.bg.toString(),
},
},
},
"& + .radioButton, & + .checkbox": {
marginTop: px(12),
},
},
});
//.radioButton-label,
// .checkbox-label
const label = style("label", {
lineHeight: unit(vars.sizing.width),
marginLeft: unit(8),
cursor: "pointer",
...userSelect(),
});
const labelNote = style("labelNote", {
display: "inline-block",
fontSize: unit(vars.labelNote.fontSize),
marginLeft: unit(24),
opacity: vars.labelNote.opacity,
verticalAlign: "middle",
});
// .radioButton-disk,
// .checkbox-box
const iconContainer = style("iconContainer", {
...defaultTransition("border", "background", "opacity"),
position: "relative",
display: "inline-block",
width: unit(vars.sizing.width),
height: unit(vars.sizing.width),
verticalAlign: em(-0.18),
cursor: "pointer",
backgroundColor: colorOut(vars.main.bg),
...borders(vars.border),
});
const radioIcon = style("radioIcon", {
...absolutePosition.middleLeftOfParent(),
display: "none",
width: unit(vars.radioButton.icon.width),
height: unit(vars.radioButton.icon.height),
margin: "auto",
});
const checkIcon = style("checkBoxIcon", {
...absolutePosition.middleOfParent(),
display: "none",
width: unit(vars.checkBox.check.width),
height: unit(vars.checkBox.check.height),
color: vars.main.fg.toString(),
margin: "auto",
});
const disk = style("disk", {
borderRadius: percent(50),
});
// .radioButton-state,
// .checkbox-state
const state = style("state", {
...absolutePosition.fullSizeOfParent(),
color: vars.main.checked.fg.toString(),
});
const diskIcon = style({
width: vars.checkBox.disk.width,
height: vars.checkBox.disk.height,
//.........这里部分代码省略.........
开发者ID:vanilla,项目名称:vanilla,代码行数:101,代码来源:checkRadioStyles.ts
示例7: useThemeCache
export const titleBarClasses = useThemeCache(() => {
const globalVars = globalVariables();
const vars = titleBarVariables();
const formElementVars = formElementsVariables();
const headerColors = vars.colors;
const mediaQueries = layoutVariables().mediaQueries();
const flex = flexHelper();
const style = styleFactory("titleBar");
const root = style({
maxWidth: percent(100),
backgroundColor: headerColors.bg.toString(),
color: headerColors.fg.toString(),
$nest: {
"& .searchBar__control": {
color: vars.colors.fg.toString(),
cursor: "pointer",
},
"&& .suggestedTextInput-clear.searchBar-clear": {
$nest: {
"&:hover": {
color: vars.colors.fg.toString(),
},
"&:active": {
color: vars.colors.fg.toString(),
},
"&:focus": {
color: vars.colors.fg.toString(),
},
},
},
"& .searchBar__placeholder": {
color: vars.colors.fg.fade(0.8).toString(),
cursor: "pointer",
},
[`& .${backLinkClasses().link}`]: {
$nest: {
"&, &:hover, &:focus, &:active": {
color: colorOut(vars.colors.fg),
},
},
},
},
...mediaQueries.oneColumnDown({
height: px(vars.sizing.mobile.height),
}).$nest,
});
const spacer = style(
"spacer",
{
height: px(vars.sizing.height),
},
mediaQueries.oneColumnDown({
height: px(vars.sizing.mobile.height),
}),
);
const bar = style(
"bar",
{
display: "flex",
justifyContent: "space-between",
flexWrap: "nowrap",
alignItems: "center",
height: px(vars.sizing.height),
width: percent(100),
$nest: {
"&.isHome": {
justifyContent: "space-between",
},
},
},
mediaQueries.oneColumnDown({ height: px(vars.sizing.mobile.height) }),
);
const logoContainer = style(
"logoContainer",
{
display: "inline-flex",
alignSelf: "center",
color: colorOut(vars.colors.fg),
$nest: {
"&.focus-visible": {
$nest: {
"&.headerLogo-logoFrame": {
outline: `5px solid ${vars.buttonContents.state.bg}`,
background: colorOut(vars.buttonContents.state.bg),
borderRadius: vars.button.borderRadius,
},
},
},
},
},
mediaQueries.oneColumnDown({ height: px(vars.sizing.mobile.height) }),
);
const logoFlexBasis = style("logoFlexBasis", {
flexBasis: vars.endElements.flexBasis,
});
//.........这里部分代码省略.........
开发者ID:vanilla,项目名称:vanilla,代码行数:101,代码来源:titleBarStyles.ts
示例8: useThemeCache
export const mobileDropDownClasses = useThemeCache(() => {
const vars = mobileDropDownVariables();
const globalVars = globalVariables();
const frameVars = frameVariables();
const titleBarVars = titleBarVariables();
const mediaQueries = layoutVariables().mediaQueries();
const flex = flexHelper();
const style = styleFactory("mobileDropDown");
const root = style({
...flex.middle(),
position: "relative",
flexGrow: 1,
overflow: "hidden",
});
const modal = style("modal", {
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "flex-start",
$nest: {
".siteNav": {
paddingLeft: px(globalVars.gutter.half),
},
"&.modal": {
borderTopLeftRadius: 0,
borderTopRightRadius: 0,
},
},
});
const panel = style("panel", {
position: "relative",
maxHeight: percent(100),
padding: px(0),
});
const toggleButton = style(
"toggleButton",
{
...flex.middle(),
...userSelect(),
flexGrow: 1,
maxWidth: calc(`100% - ${px(globalVars.spacer.size)}`),
marginLeft: px(globalVars.spacer.size / 2),
marginRight: px(globalVars.spacer.size / 2),
outline: 0,
},
mediaQueries.xs({
maxWidth: percent(100),
margin: 0,
padding: px(0),
}),
);
const buttonContents = style("buttonContents", {
display: "inline-block",
position: "relative",
paddingRight: vars.chevron.width * 2,
overflow: "hidden",
textOverflow: "ellipsis",
maxWidth: percent(100),
});
const title = style(
"title",
{
display: "inline",
letterSpacing: vars.title.letterSpacing,
fontWeight: globalVars.fonts.weights.semiBold,
textAlign: "center",
},
mediaQueries.xs({
textAlign: "left",
}),
);
const icon = style("icon", {
position: "absolute",
display: "block",
top: 0,
right: 0,
bottom: 0,
maxHeight: percent(100),
maxWidth: percent(100),
margin: `auto 0`,
height: vars.chevron.height,
width: vars.chevron.width,
});
const closeModalIcon = style("closeModalIcon", {
padding: px(0),
margin: "auto",
color: vars.chevron.color.toString(),
$nest: {
"&:hover": {
color: colorOut(globalVars.mainColors.primary),
},
"&:active": { color: colorOut(globalVars.mainColors.primary) },
//.........这里部分代码省略.........
开发者ID:vanilla,项目名称:vanilla,代码行数:101,代码来源:mobileDropDownStyles.ts
注:本文中的@library/styles/styleHelpers.flexHelper函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论