hand JSBloqs
hand GutenBloqs
hand kuworking
What?
nochedía
Button-Transitions
By kuworking
/** @jsx jsx */
import React from 'react'
import styled from '@emotion/styled'
import { jsx, css } from '@emotion/core'

export default () => {
  return (
    <>
      <link href="https://fonts.googleapis.com/css2?family=Kulim+Park&display=swap" rel="stylesheet"></link>
      <link href="/20201011_iframe.css" type="text/css" rel="stylesheet" />
      <Grid id="bloq">
        {Object.entries(styles).map(([key, value], i) => (
          <button key={i} css={css(styles[key])} text={key}>
            <div>jsbloqs</div>
            <div>{key}</div>
          </button>
        ))}
      </Grid>
    </>
  )
}

const Grid = styled.div`
  font-family: 'Kulim Park', sans-serif;
  font-size: 1.4rem;
  display: grid;
  grid-template-columns: repeat(5, auto);
  grid-column-gap: 20px;
  grid-row-gap: 40px;
  padding: 20px 10px;
  justify-items: center;
  justify-content: space-between;

  width: 100%;

  @media (max-width: 930px) {
    grid-template-columns: repeat(5, auto);
    justify-content: space-around;
  }

  @media (max-width: 730px) {
    grid-template-columns: repeat(4, auto);
  }
  @media (max-width: 600px) {
    grid-template-columns: repeat(3, auto);
  }
  @media (max-width: 500px) {
    grid-template-columns: repeat(2, auto);
    grid-column-gap: 5px;
  }

  & button {
    outline: 0;
    cursor: pointer;
    width: 80px;
    height: 40px;
    border-radius: 2px;
    background: #eaeaea;
    padding: 0;
    text-transform: uppercase;

    backface-visibility: hidden;
    transform-style: preserve-3d;
  }
`

const styles = {
  growth: `
    transform: scale(1);
    color: #333;
    transition: transform 0.1s ease-in, box-shadow 0.1s ease-in, background 0.3s ease-in, color 0.1s ease-in;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      transform: scale(1.2);
      background: #ff5400;
      color: #fff;
      box-shadow: 0px 8px 12px -8px #000000;
    }

    &:hover:after {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      height: 100%;
      width: 100%;
      box-sizing: border-box;
    }
  `,
  fold: `
    z-index: 10;
    /* z-index: prevent interferences with parent's background */
    position: relative;
    backface-visibility: unset;
    transform-style: unset;
    transition: all 0.1s ease-in;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      display: flex;
      align-items: center;
      justify-content: center;
      color: #333;
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
      width: 100%;
      height: 100%;
      transition: all 0.1s ease-in;
      background: linear-gradient(to right, #eaeaea 0%, #eaeaea 50%, #eaeaea 51%, #eaeaea 100%);
    }

    &:hover {
      transform: scaleX(0.8);
    }

    &:hover > div:last-child {
      background: linear-gradient(to right, #eaeaea 0%, #f5f5f5 50%, #eaeaea 51%, #eaeaea 100%);
    }

    &:before,
    &:after {
      content: '';
      position: absolute;
      box-sizing: border-box;

      z-index: -1;
      left: 0%;
      top: 40%;
      width: 50%;
      height: 10%;
      background: #333;
      box-shadow: 0 20px 5px 0px #333;
      transition: all 0.1s ease-in;
      transform: rotate(-5deg);
    }

    &:after {
      right: 0%;
      left: auto;
      transform: rotate(5deg);
    }

    &:hover:before {
      transform: rotate(-20deg);
    }
    &:hover:after {
      transform: rotate(20deg);
    }
  `,
  bounce: `
    transform: scale(1);
    transition: all 0.2s cubic-bezier(0.47, 2.02, 0.31, -0.36);
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      transform: scale(1.2);
      background: #000;
      color: #fff;
    }
  `,
  rotate: `
    transform: rotate(0deg);
    transition: all 0.2s cubic-bezier(0.47, 2.02, 0.31, -0.36);
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      transform: rotate(4deg);
      background: #000;
      color: #fff;
    }
  `,
  rotate2: `
    transform: rotate(0deg);
    transition: all 0.5s cubic-bezier(0.47, 2.02, 0.31, -0.36);
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      transform: rotate(350deg);
      background: #000;
      color: #fff;
    }

    &:after {
      content: '';
      position: absolute;
      box-sizing: border-box;

      left: -10%;
      top: -60%;
      height: 220%;
      width: 120%;
      border-radius: 50%;
      transform-origin: 40% 0%;
    }
  `,
  rotate3: `
    transform: rotate(0deg);
    transition: transform 0.5s cubic-bezier(1, 0, 0, 1), background 0.5s ease-in, color 0.5s ease-in;
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      transform: rotate(350deg);
      background: #000;
      color: #fff;
    }

    &:after {
      content: '';
      position: absolute;
      box-sizing: border-box;

      left: -10%;
      top: -60%;
      height: 220%;
      width: 120%;
      border-radius: 50%;
      background: linear-gradient(211deg, #e96d4170, #d2194970);
      transform-origin: 40% 0%;
      opacity: 0.2;
      transition: all 0.5s ease-in;
    }

    &:hover:after {
      opacity: 1;
      transition: all 0.5s ease-in;
    }
  `,
  float: `
    transform: rotate(0deg);
    transition: all 0.1s ease-in;
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      transform: translateY(-8px);
      background: #ff5400;
      color: #fff;
      box-shadow: 0px 31px 12px -19px #000;
    }
  `,
  float2: `
    transform: rotate(0deg);
    transition: all 0.1s ease-in;
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      transform: translateX(10px);
      background: #ff5400;
      color: #fff;
      box-shadow: -10px 13px 12px -13px #000;
    }
  `,
  sweep: `
    transform: rotate(0deg);
    transition: all 0.5s ease-in;
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      box-shadow: -10px 13px 12px -13px #000;
    }

    &:after {
      content: '';
      position: absolute;
      box-sizing: border-box;
      z-index: -1;

      left: 0;
      top: 0;
      height: 100%;
      width: 100%;
      background: linear-gradient(158deg, #ecf8d0, #33c9f8);
      transition: all 0.1s ease-in;
      transform: scaleX(0);
      transform-origin: 0% 50%;
    }

    &:hover:after {
      transform: scaleX(1);
    }
  `,
  sweepline: `
    transform: rotate(0deg);
    overflow: hidden;
    transition: all 0.5s ease-in;
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      background: #5a5a5a;
      box-shadow: -10px 13px 12px -13px #000;
    }

    &:after {
      content: '';
      position: absolute;
      box-sizing: border-box;
      z-index: -1;

      top: 0;
      left: -150px;
      width: 200px;
      height: 20px;
      background: linear-gradient(165deg, #d461c9, #f97f2b);
      transition: all 0.3s ease-in;
      transform: rotateZ(45deg);
      transform-origin: 40% 0%;
    }

    &:hover:after {
      left: 150px;
    }
  `,
  lateral: `
    transform: rotate(0deg);
    overflow: hidden;
    transition: all 0.1s ease-in;
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      padding-left: 10px;
      box-shadow: -10px 13px 12px -13px #000;
    }

    &:after {
      content: '';
      position: absolute;
      box-sizing: border-box;
      z-index: -1;

      top: 0;
      left: -40px;
      width: 40px;
      height: 100%;
      background: #f00;
      transition: all 0.1s ease-in;
      transform-origin: 0% 0%;
    }

    &:hover:after {
      left: 0px;
    }
  `,
  lateral2: `
    transform: rotate(0deg);
    overflow: hidden;
    transition: all 0.1s ease-in;
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:hover {
      padding-left: 40px;
      width: 100%;
    }

    &:after {
      content: '';
      position: absolute;
      box-sizing: border-box;
      z-index: -1;

      top: 0;
      left: -40px;
      width: 40px;
      height: 100%;
      background: #f00;
      border-right: 2px solid #fff;
      transition: all 0.1s ease-in;
      transform-origin: 0% 0%;
    }
    &:hover:after {
      left: 0px;
    }
  `,
  vertical: `
    transform: rotate(0deg);
    overflow: hidden;
    transition: all 0.1s ease-in;
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:after {
      content: 'JSBLOQS';
      position: absolute;
      box-sizing: border-box;
      z-index: 1;

      top: -40px;
      left: 0px;
      width: 100%;
      height: 40px;
      background: #f00;
      transition: all 0.1s ease-in;
      transform-origin: 0% 0%;

      font-weight: 700;
      color: #fff;
      padding: 5px;
    }

    &:hover:after {
      top: 0px;
    }
  `,
  bottom: `
    transform: rotate(0deg);
    overflow: hidden;
    transition: all 0.1s ease-in;
    color: #333;

    & > div:first-of-type {
      display: none;
    }

    & > div:last-child {
      font-size: 1.1em;
      font-weight: 700;
      padding: 5px;
    }

    &:after {
      content: '';
      position: absolute;
      box-sizing: border-box;
      z-index: 1;

      bottom: -6px;
      left: 0px;
      width: 100%;
      height: 6px;
      background: #f00;
      transition: all 0.3s ease-in;
      transform-origin: 0% 0%;

      font-weight: 700;
      color: #fff;
    }

    &:hover:after {
      bottom: 0px;
    }
  `,
  flip: `
    transform: rotate(0deg);
    transform-origin: 0% 0%;
    transition: all 0.1s ease-in;
    color: #333;

    & > div:first-of-type,
    & > div:last-child {
      position: absolute;
      display: flex;
      align-items: center;
      justify-content: center;
      top: 0px;
      left: 0px;
      width: 100%;
      height: 100%;
      padding: 5px;
      border-radius: 2px;
      background: linear-gradient(44deg, #ff5400, #000000);
      color: #fff;

      font-size: 1.1em;
      font-weight: 700;

      z-index: -1;
    }

    & > div:last-child {
      background: #eaeaea;
      color: #000;

      z-index: 1;
      transition: all 0.1s ease-in;
      transform-origin: 0% 0%;
    }

    &:hover > div:last-child {
      transform: rotate(-105deg);
    }
  `,
}
Privacidad
by kuworking.com
[ 2020 >> kuworking ]