@@ -4,30 +4,36 @@ import Img from '@/Img'
44import { css } from '@/utils'
55
66import {
7- getWidth ,
87 getIconSize ,
98 getFontSize ,
109 getMargin ,
1110 getSimpleMargin ,
11+ //
12+ getArrowTopOffset ,
13+ getArrowMaxWidth ,
14+ getArrowInitWidth ,
1215} from './metircs/arrow_button'
1316
1417type TWrapper = {
1518 disabled : boolean
1619 dimWhenIdle : boolean
20+ direction : 'left' | 'right'
1721 size : string
18- width : number
1922}
2023export const Wrapper = styled . div < TWrapper > `
24+ position: relative;
2125 ${ css . flex ( 'align-center' ) } ;
2226 opacity: ${ ( { dimWhenIdle, disabled } ) =>
2327 dimWhenIdle || disabled ? '0.65' : 1 } ;
24- min-width: ${ ( { size, width } ) => getWidth ( size , width ) } ;
28+ justify-content: ${ ( { direction } ) =>
29+ direction === 'left' ? 'flex-end' : 'flex-start' } ;
30+ margin-left: ${ ( { size } ) => getArrowMaxWidth ( size ) } ;
2531
2632 &:hover {
2733 cursor: ${ ( { disabled } ) => ( disabled ? 'not-allowed' : 'pointer' ) } ;
2834 opacity: ${ ( { disabled } ) => ( disabled ? 0.65 : 1 ) } ;
2935 }
30- transition: all 0.25s ;
36+ transition: all 0.2s ;
3137`
3238export const Text = styled . div < { size : string } > `
3339 font-size: ${ ( { size } ) => getFontSize ( size ) } ;
@@ -42,33 +48,37 @@ export const Icon = styled(Img)<{ size: string }>`
4248`
4349type TIcon = { size : string ; arrowStyle : string ; disabled : boolean }
4450export const LeftIcon = styled ( Icon ) < TIcon > `
51+ position: absolute;
52+ top: ${ ( { size } ) => getArrowTopOffset ( size ) } ;
53+ left: ${ ( { size } ) => `-${ getArrowInitWidth ( size ) } ` } ;
54+
55+ opacity: 0.6;
4556 margin-right: ${ ( { size, arrowStyle } ) =>
4657 arrowStyle === 'default' ? getMargin ( size ) : getSimpleMargin ( size ) } ;
4758
4859 ${ Wrapper } :hover & {
49- margin-left: ${ ( { arrowStyle, disabled } ) => {
60+ opacity: 1;
61+ left: ${ ( { size, disabled } ) => {
5062 if ( disabled ) return 0
51- return arrowStyle === 'default' ? '-4px' : '-2px'
63+ return `- ${ getArrowMaxWidth ( size ) } `
5264 } } ;
53- /* margin-left: ${ ( { size, arrowStyle, disabled } ) => {
54- return arrowStyle === 'default'
55- ? `-${ getMargin ( size , ! disabled ) } `
56- : `-${ getSimpleMargin ( size , ! disabled ) } `
57- } } ; */
58- fill: #327ca1;
5965 }
6066`
6167export const RightIcon = styled ( Icon ) < TIcon > `
68+ position: absolute;
69+ top: ${ ( { size } ) => getArrowTopOffset ( size ) } ;
70+ right: ${ ( { size } ) => `-${ getArrowInitWidth ( size ) } ` } ;
71+
72+ opacity: 0.6;
6273 margin-left: ${ ( { size, arrowStyle } ) =>
6374 arrowStyle === 'default' ? getMargin ( size ) : getSimpleMargin ( size ) } ;
6475
6576 ${ Wrapper } :hover & {
66- margin-left: ${ ( { size , arrowStyle , disabled } ) => {
67- return arrowStyle === 'default'
68- ? getMargin ( size , ! disabled )
69- : getSimpleMargin ( size , ! disabled )
77+ opacity: 1;
78+ right: ${ ( { size , disabled } ) => {
79+ if ( disabled ) return 0
80+ return `- ${ getArrowMaxWidth ( size ) } `
7081 } } ;
71- fill: #327ca1;
7282 }
7383
7484 transform: rotate(180deg);
0 commit comments