How to use the react-spring/renderprops.animated.div function in react-spring

To help you get started, we’ve selected a few react-spring 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 codesandbox / codesandbox-client / packages / app / src / app / components / ContextMenu / elements.ts View on Github external
import styled from 'styled-components';

import { animated } from 'react-spring/renderprops';
import theme from '@codesandbox/common/lib/theme';

export const Container = styled(animated.div)`
  position: fixed;

  font-size: 0.75rem;
  background-color: ${() => theme.background4()};
  color: rgba(255, 255, 255, 0.6);
  box-shadow: -1px 3px 4px rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  z-index: 40;
  overflow: hidden;
  padding: 4px 0;

  transform-origin: 0% 0%;
  font-weight: 600;
`;

export const Item = styled.button`
github codesandbox / codesandbox-client / packages / homepage / src / screens / explore / Modal / index.js View on Github external
import React from 'react';
import styled, { createGlobalStyle } from 'styled-components';
import Portal from '@codesandbox/common/lib/components/Portal';
import { ESC } from '@codesandbox/common/lib/utils/keycodes';

import { Spring, animated } from 'react-spring/renderprops';

const NoScroll = createGlobalStyle`
  html {
    overflow: hidden;
  }
`;

const Container = styled(animated.div)`
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: auto;
  z-index: 10;

  background-color: rgba(0, 0, 0, 0.5);

  display: ${props => (props.isOpen ? 'flex' : 'none')};

  justify-content: center;
`;

const Content = styled.div`
github prabeen04 / ant-dashboard / src / container / Spring / SpringTrail.js View on Github external
import React, { Component } from 'react';
import { Trail, animated } from 'react-spring/renderprops'
import styled from 'styled-components';
import { Title } from "../../components/UI/Elements";

const Box = styled(animated.div)`
    cursor: pointer;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 50%;
    height: 20%;
    background-color: #F3FFBD;
    will-change: transform;
`
class SpringTrail extends Component {
    state = { toggle: true, items: ['item1', 'item2', 'item3', 'item4', 'item5'] }
    toggle = () => this.setState(state => ({ toggle: !state.toggle }))
    render() {
        const { toggle, items } = this.state
        return (
github LN-Zap / zap-desktop / renderer / components / UI / RadioCard.js View on Github external
const Card = styled(BaseCard)`
  position: relative;
  height: 215px;
  width: 170px;
  border-radius: 40px;
  padding: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
`
const Container = styled(Flex)`
  cursor: ${props => (props.isDisabled ? 'auto' : 'pointer')};
  position: relative;
  width: 170px;
`

const BoltContainer = styled(animated.div)`
  position: absolute;
  top: -38px;
  left: 12px;
`

const RadioCard = ({ fieldApi, icons, value, label, isDisabled, description, ...rest }) => {
  const { icon: Icon, width: iconWidth, height: iconHeight } = icons[value]
  const isSelected = fieldApi.getValue() === value
  return (
     !isDisabled && fieldApi.setValue(value)}
    >
github lorikeetui / lorikeet / src / components / Slider / Slider.js View on Github external
width: calc(100% + ${HANDLE_SIZE + HANDLE_SHADOW_MARGIN * 2}px);
  height: calc(100% + ${HANDLE_SHADOW_MARGIN * 2}px);
  transform-origin: 50% 50%;
  transform: translate(
    -${HANDLE_SIZE / 2 + HANDLE_SHADOW_MARGIN}px,
    -${HANDLE_SHADOW_MARGIN}px
  );
`

const HandlePosition = styled(animated.div)`
  width: calc(100% - ${HANDLE_SIZE + HANDLE_SHADOW_MARGIN * 2}px);
  height: 100%;
  transform-origin: 50% 50%;
`

const Handle = styled(animated.div)`
  position: absolute;
  top: 50%;
  left: 0;
  width: ${HANDLE_SIZE}px;
  height: ${HANDLE_SIZE}px;
  border-radius: 50%;
`

export default Slider
github lorikeetui / lorikeet / src / components / Slider / Slider.js View on Github external
}
}

const Main = styled.div`
  min-width: ${MIN_WIDTH}px;
  padding: 0 ${HANDLE_SIZE / 2 + PADDING}px;
  ${unselectable};
`

const Area = styled.div`
  position: relative;
  height: ${HEIGHT}px;
  cursor: pointer;
`

const Bars = styled(animated.div)`
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  overflow: hidden;
  border-radius: 2px;
  height: ${BAR_HEIGHT}px;
`

const Bar = styled(animated.div)`
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
github codesandbox / codesandbox-client / packages / app / src / app / pages / Dashboard / Content / Selection / index.js View on Github external
import React from 'react';
import styled from 'styled-components';

import { Spring, animated } from 'react-spring/renderprops';

const Container = styled(animated.div)`
  position: fixed;
  border: 1px solid ${props => props.theme.secondary};
  background-color: ${props => props.theme.secondary.clearer(0.5)};
  pointer-events: none;
`;

export function getBounds(startX, startY, endX, endY) {
  const top = startY > endY ? endY : startY;
  const left = startX > endX ? endX : startX;
  const width = startX > endX ? startX - endX : endX - startX;
  const height = startY > endY ? startY - endY : endY - startY;

  return {
    top,
    height,
    left,
github nscozzaro / physics-is-beautiful / courses / static / courses / js / containers / StudioViews / EditorsViews / containers / LessonWorkSpace / Codesandbox / app / components / ContextMenu / elements.ts View on Github external
import styled from 'styled-components';

import { animated } from 'react-spring/renderprops';
import theme from '../../../common/theme';

export const Container = styled(animated.div)`
  position: fixed;

  font-size: 0.75rem;
  background-color: ${() => theme.background4()};
  color: rgba(255, 255, 255, 0.6);
  box-shadow: -1px 3px 4px rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  z-index: 40;
  overflow: hidden;
  padding: 4px 0;

  transform-origin: 0% 0%;
  font-weight: 600;
`;

export const Item = styled.button`
github codesandbox / codesandbox-client / packages / app / src / app / pages / Dashboard / Content / CreateNewSandbox / elements.ts View on Github external
}

    &:last-child {
      border-bottom: 2px dashed ${(color || theme.secondary).clearer(0.2)};
    }

    &:hover,
    &:focus {
      background-color: ${(color || theme.secondary).clearer(0.8)};
    }
  `}
`;

export const ContainerLink = Container.withComponent(Link);

export const AnimatedModalContainer = styled(animated.div)<{
  forking: boolean;
}>`
  ${({ forking }) =>
    forking &&
    css`
      position: fixed;
      transition: 0.15s ease all;
    `};
`;