import React from 'react'; import styled from 'styled-components'; const Wrapper = styled.ul` display: block; padding: 0; bottom: 1em; text-align: center; position: absolute; width: 100%; height: 3px; `; const VerticalWrap = styled.ul` position: absolute; bottom: 0; margin: 0 0 20px; padding: 0; width: 1px; right: -17px; display: flex; flex-direction: column; background: #d8d8d8; `; const ItemWrap = styled.li` position: relative; display: inline-block; margin: 0 2px; padding: 0; text-align: center; vertical-align: top; `; const VItemWrap = styled.li` position: relative; display: inline-block; margin: 0; padding: 0; text-align: center; vertical-align: top; `; const Btn = styled.button` display: block; width: ${p => (p.active ? 24 : 12)}px; height: 3px; padding: 0; color: transparent; font-size: 0; background: #fff; border: 0; border-radius: 1px; outline: none; cursor: pointer; opacity: 0.7; transition: all 0.5s; `; const VBtn = styled.button` display: block; height: 40px; width: 1px; padding: 0; color: transparent; font-size: 0; background: ${p => (p.active ? '#1A1E2A' : 'transparent')}; border: 0; border-radius: 1px; outline: none; cursor: pointer; opacity: 0.7; transition: all 0.5s; `; const Page = styled.span` width: 18px; height: 20px; opacity: 1; font-size: 13px; color: #1a1e2a; line-height: 20px; position: absolute; letter-spacing: 0.19px; top: -26px; left: -6px; `; const PageBottom = styled.span` width: 18px; height: 20px; opacity: 1; font-size: 13px; color: #1a1e2a; line-height: 20px; position: absolute; letter-spacing: 0.19px; bottom: -20px; left: -6px; `; type IProps = { activeIndex: number; total: number; outsideVertical: boolean; }; const Indicator = function({ total, activeIndex, outsideVertical }: IProps) { return outsideVertical ? ( {'0' + (activeIndex + 1)} {[...(Array(total).keys() as any)].map(e => ( ))} {'0' + total} ) : ( {[...(Array(total).keys() as any)].map(e => ( ))} ); }; export default Indicator;