當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript csx.rem函數代碼示例

本文整理匯總了TypeScript中csx.rem函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript rem函數的具體用法?TypeScript rem怎麽用?TypeScript rem使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了rem函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: rem

import { rem } from 'csx';
import { NavLink } from '../NavLink';
import { Location } from '@cycle/history';

interface Sources {
  dom: DOMSource;
  history: MemoryStream<Location>;
}

interface Sinks {
  dom: Stream<VNode>;
}

const navLink = {
  color: '#999',
  fontSize: rem(1),
  fontWeight: 700,
  marginRight: rem(1),
  textDecoration: 'none',
  transition: 'color .3s'
};
const navLinkHover = {
  ...navLink,
  cursor: 'pointer',
  color: '#666'
};

const className = style({
  display: 'flex',
  alignContent: 'flex-end',
  $nest: {
開發者ID:cyclejs-community,項目名稱:typescript-starter-cycle,代碼行數:31,代碼來源:NavMenu.ts

示例2: style

import { Sources as RouteComponentSources, Sinks } from 'components/App';
import { Stream } from 'xstream';
import { div, h2, h3, hr, p, h4, strong, em } from '@cycle/dom';
import { BackButton } from 'components/BackButton';
import { style } from 'typestyle';
import { rem } from 'csx';
import { Commit } from 'drivers/github';

interface Sources extends RouteComponentSources {
  sha$: Stream<string>;
}

const className = style({
  display: 'inline',
  marginLeft: rem(1)
});

const xs = Stream;

const getDom = ({ sha, commit: { message, author: { name, email, date } } }: Commit) => [
  h3([message.split('\n\n')[0]]),
  h4([strong([name])]),
  h4([email]),
  h4([em([date])]),
  p([message.split('\n\n')[1] || ''])
];

export const Details: (sources: Sources) => Partial<Sinks> = ({ dom, github, sha$ }) => {
  const backButton = BackButton({ dom });
  const details$ =
    sha$
開發者ID:cyclejs-community,項目名稱:typescript-starter-cycle,代碼行數:31,代碼來源:index.ts

示例3: style

import { pluck } from 'utils/pluck';
import { Layout } from './';
import { Header } from 'components/Header';
import { Stream } from 'xstream';
import { header, div, hr, main } from '@cycle/dom';
import { style } from 'typestyle';
import { rem } from 'csx';

const className = style({
  $nest: {
    '&>header': {
      padding: rem(1),
    },
    '&>main': {
      padding: rem(1)
    }
  }
});

const xs = Stream;

export const HeaderLayout: Layout = ({ dom, history, github, component: { dom: componentDom, ...component } }) => {
  const headerComponent = Header({ dom, history });
  const vdom$ =
    xs.combine(headerComponent.dom, componentDom || xs.empty())
      .map(([headerDom, component]) =>
        div(`.header.layout.${className}`, [
          header(headerDom),
          hr(),
          main(component)
        ])
開發者ID:cyclejs-community,項目名稱:typescript-starter-cycle,代碼行數:31,代碼來源:HeaderLayout.ts

示例4: style

interface Sinks {
  dom: Stream<VNode>;
}

const className = style({
  display: 'flex',
  $nest: {
    '& h1': {
      marginBottom: 0,
      marginTop: 0,
      flex: '1 0 60%',
      lineHeight: 1
    },
    '& em': {
      fontSize: rem(1)
    },
    '& nav': {
      flex: 1
    }
  }
});

const xs = Stream;

export const Header = ({ dom, history }: Sources): Sinks => {
  const navMenu = NavMenu({ dom, history });
  const vdom$ = navMenu.dom.map(navMenu =>
    div(`.${className}`, [
      h1([
        'TypeScript Starter Cycle',
開發者ID:cyclejs-community,項目名稱:typescript-starter-cycle,代碼行數:30,代碼來源:index.ts

示例5: style

import { style, media } from 'typestyle'
import { rem } from 'csx'
import size from '../../style/sizes'
import { h1 } from '../../style/headings'

export const teaserStyle = style(
  {
    marginTop: rem(2.333),
    marginBottom: rem(2.333),
    $nest: {
      'h1': h1.xs
    }
  },
  media(
    { minWidth: size.md },
    {
      marginTop: rem(4.333),
      marginBottom: rem(2.333)
    }
  ),
  media(
    { minWidth: size.lg },
    {
      // marginTop: rem(2.333),
      // marginBottom: rem(2.333),
      $nest: {
        'h1': h1.lg
      }
    }
  )
)
開發者ID:katallaxie,項目名稱:katallaxie.github.com,代碼行數:31,代碼來源:style.ts

示例6: style

import { Commit } from 'drivers/github';
import { style } from 'typestyle';
import { rem } from 'csx';

interface Sources {
  dom: DOMSource;
  commit$: Stream<Commit>;
}

interface Sinks {
  dom: Stream<VNode>;
  history: Stream<string>;
}

const className = style({
  marginBottom: rem(1),
  border: `${rem(.1)} solid #ddd`,
  padding: rem(1),
  listStyle: 'none',
  borderRadius: rem(.5),
  $nest: {
    'h4, h5': {
      marginTop: 0,
      marginBottom: rem(.5)
    },
    h5: {
      marginBottom: 0
    }
  }
});
開發者ID:cyclejs-community,項目名稱:typescript-starter-cycle,代碼行數:30,代碼來源:CommitListItem.ts


注:本文中的csx.rem函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。