本文整理匯總了TypeScript中csx.viewHeight函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript viewHeight函數的具體用法?TypeScript viewHeight怎麽用?TypeScript viewHeight使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了viewHeight函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: useThemeCache
export const bodyCSS = useThemeCache(() => {
const globalVars = globalVariables();
cssRule("html, body", {
backgroundColor: colorOut(globalVars.body.backgroundImage.color),
...fonts({
size: globalVars.fonts.size.medium,
family: globalVars.fonts.families.body,
color: globalVars.mainColors.fg,
}),
wordBreak: "break-word",
overscrollBehavior: "none", // For IE -> https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior
});
cssRule("*", {
// For Mobile Safari -> https://developer.mozilla.org/en-US/docs/Web/CSS/overscroll-behavior
"-webkit-overflow-scrolling": "touch",
});
cssRule("h1, h2, h3, h4, h5, h6", {
display: "block",
lineHeight: globalVars.lineHeights.condensed,
...margins({
all: 0,
}),
...paddings({
all: 0,
}),
});
cssRule("p", {
...margins({
all: 0,
}),
...paddings({
all: 0,
}),
});
cssRule(".page", {
display: "flex",
overflow: "visible",
flexDirection: "column",
width: percent(100),
minHeight: viewHeight(100),
position: "relative",
zIndex: 0,
});
cssRule(".page-minHeight", {
flexGrow: 1,
display: "flex",
flexDirection: "column",
});
});
示例2: fakeBackgroundFixed
export function fakeBackgroundFixed() {
return {
content: quote(""),
display: "block",
position: "fixed",
top: px(0),
left: px(0),
width: viewWidth(100),
height: viewHeight(100),
};
}
示例3: useThemeCache
export const richEditorVariables = useThemeCache(() => {
const globalVars = globalVariables();
const varsFormElements = formElementsVariables();
const makeThemeVars = variableFactory("richEditor");
const animations = standardAnimations();
const colors = makeThemeVars("colors", {
bg: globalVars.mainColors.bg,
outline: globalVars.mainColors.primary.fade(0.6),
});
const spacing = makeThemeVars("spacing", {
paddingLeft: 36,
paddingRight: 36,
paddingTop: 12,
paddingBottom: 12,
embedMenu: 0,
});
const sizing = makeThemeVars("sizing", {
minHeight: 200,
emojiSize: 40,
});
const menuButton = makeThemeVars("menuButton", {
size: 42,
});
const paragraphMenuHandle = makeThemeVars("paragraphMenuHandle", {
size: 28,
offset: -varsFormElements.border.width + 1,
});
const insertLink = makeThemeVars("insertLink", {
width: 287,
});
const flyout = makeThemeVars("flyout", {
padding: {
vertical: 12,
horizontal: 12,
},
maxHeight: viewHeight(100),
height: menuButton.size,
});
const nub = makeThemeVars("nub", {
width: 12,
});
const menu = makeThemeVars("menu", {
borderWidth: 1,
offset: nub.width * 2,
});
const pilcrow = makeThemeVars("pilcrow", {
offset: 9,
fontSize: 14,
animation: {
duration: ".3s",
name: animations.fadeIn,
timing: "ease-out",
iterationCount: 1,
},
});
const emojiGroup = makeThemeVars("emojiGroup", {
paddingLeft: 3,
offset: -(varsFormElements.border.width + menu.borderWidth * 2),
});
const embedMenu = makeThemeVars("embedMenu", {
padding: 0,
mobile: {
border: {
color: globalVars.mainColors.primary,
},
transition: {
duration: ".15s",
timing: "ease-out",
},
},
});
const embedButton = makeThemeVars("embedButton", {
offset: -varsFormElements.border.width,
});
const text = makeThemeVars("text", {
offset: 0,
});
const title = makeThemeVars("titleInput", {
height: globalVars.fonts.size.title + globalVars.gutter.half,
fontSize: globalVars.fonts.size.title,
placeholder: {
color: globalVars.mixBgAndFg(0.5),
},
});
//.........這裏部分代碼省略.........
示例4: cssRule
cssRule('.modal-header > h1, h2, h3, h4, h5, h6', {
marginTop: px(10)
});
cssRule('html, body', {
height: percent(100)
});
cssRule('span, p, label', {
userSelect: 'none',
cursor: 'default'
});
cssRule('#content', {
height: viewHeight(100),
width: viewWidth(100)
});
cssRule('.panel-body', {
padding: px(10)
});
export const mainWindow = style({
$debugName: 'mainWindow',
height: percent(100),
width: percent(100)
});
export const spaceLeft = style({
示例5: useThemeCache
export const insertEmojiClasses = useThemeCache(() => {
const globalVars = globalVariables();
const vars = richEditorVariables();
const style = styleFactory("insertEmoji");
const root = style({
...appearance(),
display: "flex",
alignItems: "center",
justifyContent: "center",
fontSize: unit(globalVars.icon.sizes.default),
textAlign: "center",
overflow: "hidden",
border: 0,
opacity: globalVars.states.text.opacity,
cursor: "pointer",
borderRadius: unit(3),
$nest: {
...buttonStates(
{
allStates: {
outline: 0,
},
hover: {
opacity: 1,
},
focus: {
opacity: 1,
},
active: {
opacity: 1,
},
accessibleFocus: {
backgroundColor: colorOut(globalVars.states.hover.color),
},
},
{
".fallBackEmoji": {
display: "block",
margin: "auto",
},
".safeEmoji": {
display: "block",
height: unit(globalVars.icon.sizes.default),
width: unit(globalVars.icon.sizes.default),
margin: "auto",
},
},
),
},
});
const body = style("body", {
height: unit(vars.emojiBody.height),
maxHeight: viewHeight(80),
});
const popoverDescription = style("popoverDescription", {
marginBottom: ".5em",
});
return { root, body, popoverDescription };
});
示例6: useThemeCache
export const panelLayoutClasses = useThemeCache(() => {
const globalVars = globalVariables();
const vars = layoutVariables();
const mediaQueries = vars.mediaQueries();
const style = styleFactory("panelLayout");
const classesPanelArea = panelAreaClasses();
const classesPanelList = panelListClasses();
const titleBarVars = titleBarVariables();
const main = style("main", {
minHeight: viewHeight(20),
width: percent(100),
});
const root = style({
...margins(vars.panelLayoutSpacing.margin),
width: percent(100),
$nest: {
[`&.noBreadcrumbs > .${main}`]: {
paddingTop: unit(globalVars.gutter.size),
...mediaQueries.oneColumnDown({
paddingTop: 0,
}),
},
"&.isOneCol": {
width: unit(vars.middleColumn.paddedWidth),
maxWidth: percent(100),
margin: "auto",
...mediaQueries.oneColumnDown({
width: percent(100),
}),
},
"&.hasTopPadding": {
paddingTop: unit(vars.panelLayoutSpacing.extraPadding.top),
},
"&.hasTopPadding.noBreadcrumbs": {
paddingTop: unit(vars.panelLayoutSpacing.extraPadding.noBreadcrumbs.top),
},
"&.hasLargePadding": {
...paddings(vars.panelLayoutSpacing.largePadding),
},
},
});
const content = style("content", {
display: "flex",
flexGrow: 1,
width: percent(100),
justifyContent: "space-between",
});
const panel = style("panel", {
width: percent(100),
$nest: {
[`& > .${classesPanelArea.root}:first-child .${classesPanelList.root}`]: {
marginTop: unit(
(globalVars.fonts.size.title * globalVars.lineHeights.condensed) / 2 -
globalVariables().fonts.size.medium / 2,
),
},
},
});
const top = style("top", {
width: percent(100),
marginBottom: unit(globalVars.gutter.half),
});
const container = style("container", {
display: "flex",
flexWrap: "nowrap",
alignItems: "flex-start",
justifyContent: "space-between",
});
const fullWidth = style("fullWidth", {
position: "relative",
padding: 0,
});
const leftColumn = style("leftColumn", {
position: "relative",
width: unit(vars.panel.paddedWidth),
flexBasis: unit(vars.panel.paddedWidth),
minWidth: unit(vars.panel.paddedWidth),
});
const rightColumn = style("rightColumn", {
position: "relative",
width: unit(vars.panel.paddedWidth),
flexBasis: unit(vars.panel.paddedWidth),
minWidth: unit(vars.panel.paddedWidth),
overflow: "initial",
});
const middleColumn = style("middleColumn", {
justifyContent: "space-between",
flexGrow: 1,
width: percent(100),
maxWidth: percent(100),
//.........這裏部分代碼省略.........
示例7: useThemeCache
export const modalClasses = useThemeCache(() => {
const globalVars = globalVariables();
const vars = modalVariables();
const style = styleFactory("modal");
const mediaQueries = layoutVariables().mediaQueries();
const shadows = shadowHelper();
const titleBarVars = titleBarVariables();
const overlay = style("overlay", {
position: "fixed",
// Viewport units are useful here because
// we're actually fine this being taller than the initially visible viewport.
height: viewHeight(100),
width: percent(100),
top: 0,
left: 0,
right: 0,
bottom: 0,
background: colorOut(vars.colors.overlayBg),
zIndex: 10,
});
const root = style({
display: "flex",
flexDirection: "column",
width: percent(100),
maxWidth: percent(100),
maxHeight: viewHeight(80),
zIndex: 1,
backgroundColor: colorOut(vars.colors.bg),
position: "fixed",
top: percent(50),
left: percent(50),
bottom: "initial",
overflow: "hidden",
borderRadius: unit(vars.border.radius),
// NOTE: This transform can cause issues if anything inside of us needs fixed positioning.
// See http://meyerweb.com/eric/thoughts/2011/09/12/un-fixing-fixed-elements-with-css-transforms/
// See also https://www.w3.org/TR/2009/WD-css3-2d-transforms-20091201/#introduction
// This is why fullscreen unsets the transforms.
transform: translate(`-50%`, `-50%`),
...margins({ all: "auto" }),
$nest: {
"&&.isFullScreen": {
width: percent(100),
height: percent(100),
maxHeight: percent(100),
maxWidth: percent(100),
borderRadius: 0,
border: "none",
top: 0,
bottom: 0,
transform: "none",
left: 0,
right: 0,
},
"&.isLarge": {
width: unit(vars.sizing.large),
maxWidth: calc(`100% - ${unit(vars.spacing.horizontalMargin * 2)}`),
},
"&.isMedium": {
width: unit(vars.sizing.medium),
maxWidth: calc(`100% - ${unit(vars.spacing.horizontalMargin * 2)}`),
},
"&.isSmall": {
width: unit(vars.sizing.small),
maxWidth: calc(`100% - ${unit(vars.spacing.horizontalMargin * 2)}`),
},
"&&&.isSidePanel": {
left: unit(vars.dropDown.padding),
width: calc(`100% - ${unit(vars.dropDown.padding)}`),
display: "flex",
flexDirection: "column",
top: 0,
bottom: 0,
right: 0,
transform: "none",
borderTopRightRadius: 0,
borderBottomRightRadius: 0,
},
"&&.isDropDown": {
top: 0,
left: 0,
right: 0,
bottom: globalVars.gutter.size,
width: percent(100),
marginBottom: "auto",
transform: "none",
maxHeight: percent(100),
borderTopLeftRadius: 0,
borderTopRightRadius: 0,
},
"&.isShadowed": {
...shadows.dropDown(),
...borders(),
},
},
});
//.........這裏部分代碼省略.........
示例8: useThemeCache
export const titleBarVariables = useThemeCache(() => {
const globalVars = globalVariables();
const formElementVars = formElementsVariables();
const makeThemeVars = variableFactory("titleBar");
const sizing = makeThemeVars("sizing", {
height: 48,
spacer: 12,
mobile: {
height: 44,
width: formElementVars.sizing.height,
},
});
const colors = makeThemeVars("colors", {
fg: globalVars.mainColors.bg,
bg: globalVars.mainColors.primary,
});
const guest = makeThemeVars("guest", {
spacer: 8,
});
const buttonSize = formElementVars.sizing.height;
const button = makeThemeVars("button", {
borderRadius: globalVars.border.radius,
size: buttonSize,
guest: {
minWidth: 86,
},
mobile: {
fontSize: 16,
width: buttonSize,
},
state: {
bg: emphasizeLightness(colors.bg, 0.04),
},
});
const count = makeThemeVars("count", {
size: 18,
fontSize: 10,
fg: globalVars.mainColors.bg,
bg: globalVars.mainColors.primary,
});
const dropDownContents = makeThemeVars("dropDownContents", {
minWidth: 350,
maxHeight: viewHeight(90),
});
const endElements = makeThemeVars("endElements", {
flexBasis: buttonSize * 4,
mobile: {
flexBasis: button.mobile.width * 2,
},
});
const compactSearch = makeThemeVars("compactSearch", {
maxWidth: 672,
mobile: {
width: button.mobile.width,
},
});
const buttonContents = makeThemeVars("buttonContents", {
state: {
bg: button.state.bg,
},
});
const signIn = makeThemeVars("signIn", {
fg: colors.fg,
bg: modifyColorBasedOnLightness(globalVars.mainColors.primary, 0.1, true),
hover: {
bg: modifyColorBasedOnLightness(globalVars.mainColors.primary, 0.2, true),
},
});
const resister = makeThemeVars("register", {
fg: colors.bg,
bg: colors.fg,
borderColor: colors.bg,
states: {
bg: colors.fg.fade(0.9),
},
});
const mobileDropDown = makeThemeVars("mobileDropdown", {
height: px(sizing.mobile.height),
});
const meBox = makeThemeVars("meBox", {
sizing: {
buttonContents: 32,
},
});
const bottomRow = makeThemeVars("bottomRow", {
bg: modifyColorBasedOnLightness(colors.bg, 0.1).desaturate(0.2, true),
//.........這裏部分代碼省略.........