Skip to content

junhoyeo/css-in-js-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛫 styled-platform

📦 Installation

npm install styled-platform
# Or with yarn
yarn add styled-platform

🚀 Usage

You can use this module in 3 different ways.

import platform from 'styled-platform';

const exampleText = styled.Text`
  ${platform({
    ios: css`
      font-size: 14px;
    `,
    android: css`
      font-size: 12px;
    `,
  })}
`;
import platform from 'styled-platform';

const exampleText = styled.Text`
  font-size: 14px;

  ${platform('android', css`
    font-size: 14px;
  `)}
`;
import platform from 'styled-platform';

const exampleText = styled.Text`
  font-size: 14px;

  ${platform.android(css`
    font-size: 14px;
  `)}
`;
  • The platform keys can be one of 'ios' | 'android' | 'macos' | 'windows' | 'web', which is from PlatformOSType of react-native(here).

About

🛫 Platform.select for native CSS-IN-JS solutions(styled-components, emotion, etc.)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published