💻
Building and hosting a WebApp
  • Getting started
  • Project setup
    • Requirements
    • Files organisation
    • Lerna
    • Linter
    • Prettier
    • GitHook
    • Testing
    • Conclusion
  • Backend
    • Files organisation
    • Environment config
    • Express API
    • Security
    • Database
    • GraphQL
    • User authentication
    • Conclusion
  • Frontend
    • Create React App
    • Files organisation
    • Styles
    • Apollo Hooks
    • Form management
    • User authentication
    • Writing tests
    • Types generation
    • Conclusion
  • DevOps
    • CI/CD
    • AWS
      • Managing secrets
      • Pricing
      • RDS
      • S3
      • Route53
      • CloudFront
      • Serverless
      • Security
      • CloudFormation
    • Conclusion
  • 🚧Stripe payment
  • 🚧File upload
Powered by GitBook
On this page

Was this helpful?

  1. Frontend

Styles

PreviousFiles organisationNextApollo Hooks

Last updated 5 years ago

Was this helpful?

So far, components are rather unattractive. Let's start using .

~/packages/web
$ yarn add styled-components @types/styled-components
Link.tsx
import * as React from "react";
import styled from "styled-components";

export interface LinkProps {
  id: string;
  uri: string;
  userId: string;
}

const Container = styled.div`
  border: 1px solid gray;
  width: 200px;
  padding: 20px;
`;

export const Link = (props: LinkProps) => (
  <Container>URI: {props.uri}</Container>
);

Read the .

styled-components
Styled Component documentation