|
| 1 | +import styled, { css } from 'styled-components'; |
| 2 | +import { Link } from '@kkt/pro'; |
| 3 | +import UserLogin from '@uiw-admin/user-login'; |
| 4 | +import * as datas from './Examples'; |
| 5 | + |
| 6 | +const Wrapper = styled.div` |
| 7 | + display: flex; |
| 8 | + justify-content: center; |
| 9 | + margin: 0 auto; |
| 10 | + flex-wrap: wrap; |
| 11 | + gap: 0.953rem; |
| 12 | +`; |
| 13 | + |
| 14 | +const Title = styled.div` |
| 15 | + width: auto !important; |
| 16 | + height: auto !important; |
| 17 | + position: absolute; |
| 18 | + transform: scale(1) !important; |
| 19 | + background-color: rgba(var(--color-rgb) / 39%); |
| 20 | + color: var(--color-canvas-default); |
| 21 | + border-radius: 5px; |
| 22 | + padding: 1px 4px 3px 4px; |
| 23 | + top: -25px; |
| 24 | + left: 10px; |
| 25 | + transition: all 0.3s; |
| 26 | +`; |
| 27 | + |
| 28 | +const Inner = styled(Link)<{ magnify?: number }>` |
| 29 | + overflow: hidden; |
| 30 | + display: block; |
| 31 | + position: relative; |
| 32 | + width: 326px; |
| 33 | + height: 265px; |
| 34 | + border-radius: 0.571rem; |
| 35 | + text-decoration: none; |
| 36 | + box-shadow: 0 0px 3px transparent; |
| 37 | + border: 1px solid transparent; |
| 38 | + transition: all 0.3s; |
| 39 | + &::before { |
| 40 | + content: ''; |
| 41 | + display: block; |
| 42 | + position: absolute; |
| 43 | + background-color: transparent; |
| 44 | + transition: all 0.3s; |
| 45 | + z-index: 2; |
| 46 | + inset: 0; |
| 47 | + } |
| 48 | + &:hover { |
| 49 | + box-shadow: 0 0px 3px rgba(0, 0, 0, 0.1); |
| 50 | + border-color: rgb(0 0 0 / 11%); |
| 51 | + } |
| 52 | + &:hover ${Title} { |
| 53 | + top: 10px; |
| 54 | + } |
| 55 | + &:hover::before { |
| 56 | + background-color: var(--color-neutral-muted); |
| 57 | + } |
| 58 | + & > * { |
| 59 | + transform-origin: top left; |
| 60 | + ${({ magnify = 2 }) => css` |
| 61 | + transform: scale(${326 / (326 * magnify)}); |
| 62 | + width: ${326 * magnify}px; |
| 63 | + height: ${265 * magnify}px; |
| 64 | + `} |
| 65 | + } |
| 66 | +`; |
| 67 | + |
| 68 | +const defulat = { |
| 69 | + magnify: 2.3, |
| 70 | + children: <UserLogin api="/api/login" />, |
| 71 | +}; |
| 72 | + |
| 73 | +export const Example = () => { |
| 74 | + return ( |
| 75 | + <Wrapper> |
| 76 | + <Inner |
| 77 | + target="_blank" |
| 78 | + to={`https://github.com/uiwjs/uiw-admin/blob/master/packages/user-login/README.md`} |
| 79 | + magnify={defulat.magnify} |
| 80 | + > |
| 81 | + {defulat.children} |
| 82 | + <Title>defulat</Title> |
| 83 | + </Inner> |
| 84 | + {Object.keys(datas).map((path, key) => { |
| 85 | + const comps = datas[path as keyof typeof datas]; |
| 86 | + return ( |
| 87 | + <Inner |
| 88 | + target="_blank" |
| 89 | + key={key} |
| 90 | + to={`https://uiwjs.github.io/react-login-page/#/pages/${path}`} |
| 91 | + magnify={comps.magnify} |
| 92 | + > |
| 93 | + {comps.children} |
| 94 | + <Title>{path}</Title> |
| 95 | + </Inner> |
| 96 | + ); |
| 97 | + })} |
| 98 | + </Wrapper> |
| 99 | + ); |
| 100 | +}; |
0 commit comments