本文整理匯總了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 };
};
示例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,
};
});
示例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,
};
});
示例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,
};
}
示例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,
};
});
示例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,
//.........這裏部分代碼省略.........
示例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,
});
//.........這裏部分代碼省略.........
示例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) },
//.........這裏部分代碼省略.........