| 1 | import styled, { keyframes } from "styled-components"; |
| 2 | |
| 3 | const gradient = keyframes` |
| 4 | 0% { |
| 5 | background-position: 0px 0; |
| 6 | } |
| 7 | 100% { |
| 8 | background-position: 100em 0; |
| 9 | } |
| 10 | `; |
| 11 | |
| 12 | export const GradientBorder = styled.div<{ |
| 13 | borderRadius?: string; |
| 14 | borderColor?: string; |
| 15 | loading: 0 | 1; |
| 16 | }>` |
| 17 | border-radius: ${(props) => props.borderRadius || "0"}; |
| 18 | padding: 1px; |
| 19 | background: ${(props) => |
| 20 | props.borderColor |
| 21 | ? props.borderColor |
| 22 | : `repeating-linear-gradient( |
| 23 | 101.79deg, |
| 24 | #1BBE84 0%, |
| 25 | #331BBE 16%, |
| 26 | #BE1B55 33%, |
| 27 | #A6BE1B 55%, |
| 28 | #BE1B55 67%, |
| 29 | #331BBE 85%, |
| 30 | #1BBE84 99% |
| 31 | )`}; |
| 32 | animation: ${(props) => (props.loading ? gradient : "")} 6s linear infinite; |
| 33 | background-size: 200% 200%; |
| 34 | width: 100%; |
| 35 | display: flex; |
| 36 | flex-direction: row; |
| 37 | align-items: center; |
| 38 | margin-top: ${(props) => (props.loading ? "8px" : "")}; |
| 39 | `; |