|
| 1 | +importstyledfrom'styled-components' |
| 2 | +import{lighten}from'polished' |
| 3 | + |
| 4 | +import{cs,theme}from'@/utils' |
| 5 | + |
| 6 | +exportconstWrapper=styled.button` |
| 7 | +${cs.flex('align-center')}; |
| 8 | + -webkit-appearance: button; |
| 9 | + outline: none; |
| 10 | +
|
| 11 | + line-height: 1.5; |
| 12 | + font-weight: 400; |
| 13 | + text-align: center; |
| 14 | + touch-action: manipulation; |
| 15 | + cursor: pointer; |
| 16 | + background-image: none; |
| 17 | + border: 1px solid transparent; |
| 18 | + white-space: nowrap; |
| 19 | + padding:${({ size})=>(size==='default' ?'4px 15px' :'0 7px')}; |
| 20 | + font-size: 14px; |
| 21 | + border-radius: 4px; |
| 22 | + height:${({ size})=>(size==='default' ?'32px' :'24px')}; |
| 23 | + user-select: none; |
| 24 | + transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); |
| 25 | + position: relative; |
| 26 | + color: rgba(0, 0, 0, 0.65); |
| 27 | + border-color: #d9d9d9; |
| 28 | +
|
| 29 | + color:${({ ghost})=> |
| 30 | +!ghost ?theme('button.fg') :theme('button.primary')}; |
| 31 | +
|
| 32 | + background-color:${({ ghost})=> |
| 33 | +!ghost ?theme('button.primary') :'transparent'}; |
| 34 | + border-color:${theme('button.primary')}; |
| 35 | +
|
| 36 | + &:hover { |
| 37 | + /* color:${theme('button.fg')}; */ |
| 38 | + color:${({ ghost})=> |
| 39 | +!ghost ?theme('button.fg') :theme('button.primary')}; |
| 40 | +
|
| 41 | + border-color:${theme('button.hoverBg')}; |
| 42 | + background-color:${({ ghost})=> |
| 43 | +!ghost ?theme('button.hoverBg') :'transparent'}; |
| 44 | + } |
| 45 | +
|
| 46 | + &:focus { |
| 47 | + color:${({ ghost})=> |
| 48 | +!ghost ?theme('button.fg') :theme('button.primary')}; |
| 49 | + border-color:${theme('button.hoverBg')}; |
| 50 | + background-color:${({ ghost})=> |
| 51 | +!ghost ?theme('button.hoverBg') :'transparent'}; |
| 52 | + } |
| 53 | +
|
| 54 | + &:active { |
| 55 | + color:${({ ghost})=> |
| 56 | +!ghost ?theme('button.fg') :theme('button.primary')}; |
| 57 | + background-color:${({ ghost})=> |
| 58 | +!ghost ?theme('button.hoverBg') :'transparent'}; |
| 59 | + } |
| 60 | +` |
| 61 | +exportconstRedWrapper=styled(Wrapper)` |
| 62 | + color:${({ ghost})=>(ghost ?theme('baseColor.error') :'white')}; |
| 63 | + background-color:${({ ghost})=> |
| 64 | +!ghost ?theme('baseColor.error') :'transparent'}; |
| 65 | + border-color:${theme('baseColor.error')}; |
| 66 | +
|
| 67 | + &:hover { |
| 68 | + border: 2px solid; |
| 69 | + background-color:${({ ghost})=> |
| 70 | +!ghost ?lighten(0.1,'tomato') :'transparent'}; |
| 71 | + border-color:${lighten(0.1,'tomato')}; |
| 72 | + font-weight:${({ ghost})=>(ghost ?'bold' :'normal')}; |
| 73 | + } |
| 74 | + &:focus { |
| 75 | + border: 2px solid; |
| 76 | + background-color:${({ ghost})=> |
| 77 | +!ghost ?lighten(0.1,'tomato') :'transparent'}; |
| 78 | + border-color:${lighten(0.1,'tomato')}; |
| 79 | + font-weight:${({ ghost})=>(ghost ?'bold' :'normal')}; |
| 80 | + } |
| 81 | + &:active { |
| 82 | + border: 2px solid; |
| 83 | + background-color:${({ ghost})=> |
| 84 | +!ghost ?lighten(0.1,'tomato') :'transparent'}; |
| 85 | + border-color:${lighten(0.1,'tomato')}; |
| 86 | + font-weight:${({ ghost})=>(ghost ?'bold' :'normal')}; |
| 87 | + } |
| 88 | + transition: all 0.25s; |
| 89 | +` |