How to use styled-react-modal - 9 common examples

To help you get started, we’ve selected a few styled-react-modal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / styled-react-modal / styled-react-modal-tests.tsx View on Github external
>
            Modal Content!
        </Modal>
    </ModalProvider>
);

// Minimal Setup
const test3 = (
    <ModalProvider>
        <Modal isOpen={true}>
            Modal Content!
        </Modal>
    </ModalProvider>
);

const StyledModal = Modal.styled`
    background: red;
`;

const test4 = (
    <ModalProvider>
        <StyledModal isOpen={true} onBackgroundClick={() => console.log('Background click!')}>
            Modal Content!
        </StyledModal>
    </ModalProvider>
);
github RetailMeNot / anchor / src / Modal / Modal.component.tsx View on Github external
// COMPONENTS
import { ModalHeader, StyledHeader } from './Header';
import { ModalContent, StyledContent } from './Content';
import { ModalFooter, StyledFooter } from './Footer';
import { ModalClose } from './Close';

export type ModalSize = 'lg' | 'sm';

const Sizes = {
    lg: { width: 50, contentPadding: 2.5, footerHeight: 6.5 },
    sm: { width: 25, contentPadding: 2, footerHeight: 5.5 },
};

const defaultSize: ModalSize = 'lg';

const StyledModal = StyledReactModal.default.styled`
    position: relative;
    width: ${({ width, size = defaultSize }: ModalProps) =>
        width || `${Sizes[size].width}rem`};
    height: ${({ height = '42.375rem' }: ModalProps) => height};
    margin: ${({ margin = 'auto' }: ModalProps) => margin};

    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: space-between;

    ${({ background = 'white', color }: ModalProps) =>
        css({
            background: th.color(background),
            color,
            borderRadius: 'modal',
github seashell / drago / ui / src / views / edit-host / new-link-modal.js View on Github external
import { useQuery } from 'react-apollo'
import * as _ from 'lodash'

import { icons } from '_assets/'

import Button from '_components/button'
import IconButton from '_components/icon-button'

import Box from '_components/box'
import Text from '_components/text'
import TextInput from '_components/inputs/text-input'
import SearchInput from '_components/inputs/search-input'

import { GET_HOSTS } from '_graphql/actions'

const StyledModal = Modal.styled`
background: white;
width: 480px;
height: 620px;
display: flex;
flex-direction: column;
border-radius: 4px;
position: relative;
padding: 32px;
${border}
${shadow}
`

const StyledIconButton = styled(IconButton)`
  position: absolute;
  right: 2px;
  top: 2px;
github guildspeak / guildspeak-desktop / src / renderer / components / CurrentUsers / styles.ts View on Github external
overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0px;
  & > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
`

export const UserStatus = styled(Status)`
  left: 34px;
  top: 37px;
`

export const StyledModal = Modal.styled`
  background: ${({ theme }) => theme.backgroundColor};
  opacity: ${(props: { opacity: number }) => props.opacity};
  font-size: 16px;
  padding: 16px;
  transition: opacity ease 200ms;
  border: none;
  border-radius: 8px;
`
github guildspeak / guildspeak-desktop / src / renderer / components / CreateGuild / styles.ts View on Github external
box-sizing: border-box;
  color: #cccccc;
  font-size: 18px;
  padding: 14px;
  display: block;
  height: 40px;
  width: 100%;
  border: none;
  border-radius: 8px;
  border-bottom: none;
  caret-color: #14bca3;
  &:focus {
    outline: none;
  }
`
export const StyledModal = Modal.styled`
  background: ${({ theme }) => theme.backgroundColor};
  opacity: ${(props: { opacity: number }) => props.opacity};
  font-size: 16px;
  padding: 16px;
  transition: opacity ease 200ms;
  border: none;
  border-radius: 8px;
`
github guildspeak / guildspeak-desktop / src / renderer / components / CreateChannel / styles.ts View on Github external
height: 40px;
  width: 100%;
  border: none;
  border-radius: 8px;
  border-bottom: none;
  caret-color: #14bca3;
  &:focus {
    outline: none;
  }
`

export const ChannelInput = styled.div`
  padding-top: 10px;
`

export const StyledModal = Modal.styled`
  background: ${({ theme }) => theme.backgroundColor};
  opacity: ${(props: { opacity: number }) => props.opacity};
  font-size: 16px;
  padding: 16px;
  transition: opacity ease 200ms;
  border: none;
  border-radius: 8px;
`
github guildspeak / guildspeak-desktop / src / renderer / components / MessageAuthor / styles.ts View on Github external
import styled from '../../utils/styled-components'
import Modal from 'styled-react-modal'

export const Wrapper = styled.div`
  &:hover {
    color: ${({ theme }) => theme.accentColor};
    text-decoration: underline;
  }
  cursor: pointer;
`

export const StyledModal = Modal.styled`
  background: ${({ theme }) => theme.backgroundColor};
  opacity: ${(props: { opacity: number }) => props.opacity};
  font-size: 16px;
  padding: 16px;
  transition: opacity ease 200ms;
  border: none;
  border-radius: 8px;
`
github RetailMeNot / anchor / src / Modal / Modal.component.tsx View on Github external
{children}
    </StyledModal>
);

Modal.Content = ModalContent;
Modal.Header = ModalHeader;
Modal.Footer = ModalFooter;
Modal.Close = ModalClose;

interface BaseModalBackgroundProps {
    opacity?: number;
    oversized?: boolean;
    padding?: string;
}

const CustomModalBackground = styled(StyledReactModal.BaseModalBackground)`
    box-sizing: border-box;
    overflow-y: auto;
    padding: ${({ padding = '2rem 1rem' }: BaseModalBackgroundProps) =>
        padding};
    background-color: ${({ opacity = 0.6 }: BaseModalBackgroundProps) =>
        `rgba(0,0,0,${opacity})`};
`;
export const BaseModalBackground = CustomModalBackground;

export class ModalProvider extends StyledReactModal.ModalProvider {
    static defaultProps = { backgroundComponent: BaseModalBackground };
}
github RetailMeNot / anchor / src / Modal / Modal.component.tsx View on Github external
opacity?: number;
    oversized?: boolean;
    padding?: string;
}

const CustomModalBackground = styled(StyledReactModal.BaseModalBackground)`
    box-sizing: border-box;
    overflow-y: auto;
    padding: ${({ padding = '2rem 1rem' }: BaseModalBackgroundProps) =>
        padding};
    background-color: ${({ opacity = 0.6 }: BaseModalBackgroundProps) =>
        `rgba(0,0,0,${opacity})`};
`;
export const BaseModalBackground = CustomModalBackground;

export class ModalProvider extends StyledReactModal.ModalProvider {
    static defaultProps = { backgroundComponent: BaseModalBackground };
}

styled-react-modal

A React modal built with styled-components.

Unlicense
Latest version published 2 months ago

Package Health Score

68 / 100
Full package analysis