diff --git a/src/Icon.tsx b/src/Icon.tsx new file mode 100644 index 0000000..25fc7c8 --- /dev/null +++ b/src/Icon.tsx @@ -0,0 +1,26 @@ +import * as React from 'react'; + +export enum ActionType { + zoomIn = 1, + zoomOut = 2, + prev = 3, + next = 4, + rotateLeft = 5, + rotateRight = 6, + reset = 7, + close = 8, +} + +export interface IconProps { + type: ActionType; +} + +export default class Icon extends React.Component { + render() { + let prefixCls = 'react-viewer-icon'; + + return ( + + ); + } +} diff --git a/src/ViewerCore.tsx b/src/ViewerCore.tsx index 2e158a2..ebaa919 100644 --- a/src/ViewerCore.tsx +++ b/src/ViewerCore.tsx @@ -2,8 +2,9 @@ import * as React from 'react'; import './style/index.less'; import ViewerCavans from './ViewerCavans'; import ViewerNav from './ViewerNav'; -import ViewerToolbar, { ActionType } from './ViewerToolbar'; +import ViewerToolbar from './ViewerToolbar'; import ViewerProps, { ImageDecorator } from './ViewerProps'; +import Icon, { ActionType } from './Icon'; function noop() {} @@ -130,6 +131,9 @@ export default class ViewerCore extends React.Component
-
+
+ +
{ constructor() { @@ -34,24 +26,26 @@ export default class ViewerToolbar extends React.Component
    -
  • {this.handleAction(ActionType.zoomIn);}}> - +
  • {this.handleAction(ActionType.zoomIn);}}> +
  • -
  • {this.handleAction(ActionType.zoomOut);}}> - +
  • {this.handleAction(ActionType.zoomOut);}}> +
  • -
  • {this.handleAction(ActionType.prev);}}> - +
  • {this.handleAction(ActionType.prev);}}> +
  • -
  • -
  • {this.handleAction(ActionType.next);}}> - +
  • {this.handleAction(ActionType.reset);}}> +
  • -
  • {this.handleAction(ActionType.rotateLeft);}}> - +
  • {this.handleAction(ActionType.next);}}> +
  • -
  • {this.handleAction(ActionType.rotateRight);}}> - +
  • {this.handleAction(ActionType.rotateLeft);}}> + +
  • +
  • {this.handleAction(ActionType.rotateRight);}}> +
diff --git a/src/style/fonts/icomoon.eot b/src/style/fonts/icomoon.eot new file mode 100644 index 0000000..4db0df4 Binary files /dev/null and b/src/style/fonts/icomoon.eot differ diff --git a/src/style/fonts/icomoon.svg b/src/style/fonts/icomoon.svg new file mode 100644 index 0000000..2457df8 --- /dev/null +++ b/src/style/fonts/icomoon.svg @@ -0,0 +1,18 @@ + + + +Generated by IcoMoon + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/style/fonts/icomoon.ttf b/src/style/fonts/icomoon.ttf new file mode 100644 index 0000000..93c16b2 Binary files /dev/null and b/src/style/fonts/icomoon.ttf differ diff --git a/src/style/fonts/icomoon.woff b/src/style/fonts/icomoon.woff new file mode 100644 index 0000000..d40e1c6 Binary files /dev/null and b/src/style/fonts/icomoon.woff differ diff --git a/src/style/index.less b/src/style/index.less index 09101bc..b321b90 100644 --- a/src/style/index.less +++ b/src/style/index.less @@ -1,9 +1,23 @@ @viewer-prefix-cls: react-viewer; +@font-face { + font-family: 'icomoon'; + src:url('fonts/icomoon.eot'); + src:url('fonts/icomoon.eot?#iefix') format('embedded-opentype'), + url('fonts/icomoon.ttf') format('truetype'), + url('fonts/icomoon.woff') format('woff'), + url('fonts/icomoon.svg') format('svg'); + font-weight: normal; + font-style: normal; +} + .@{viewer-prefix-cls} { @zIndex: 1050; + @btn-background-color: rgba(0, 0, 0, .5); + @btn-hover-background-color: rgba(0, 0, 0, .8); + & ul { margin: 0; padding: 0; @@ -25,6 +39,14 @@ filter: alpha(opacity=50); } + &-btn { + background-color: @btn-background-color; + } + + &-btn:hover{ + background-color: @btn-hover-background-color; + } + &-close { position: absolute; top: 0px; @@ -34,10 +56,15 @@ height: 40px; border-radius: 0 0 0 40px; cursor: pointer; - background-color: rgba(0, 0, 0, .5); z-index: @zIndex; } + &-close > i { + position: relative; + top: 8px; + left: 18px; + } + &-cavans { position: absolute; top: 0; @@ -86,9 +113,13 @@ width: @toolbarHeight; height: @toolbarHeight; border-radius: @toolbarHeight; - background-color: rgba(0, 0, 0, .5); margin-right: 3px; cursor: pointer; + line-height: 29px; + } + + &-toolbar li:hover { + background-color: rgba(0, 0, 0, .8); } li.empty { @@ -98,7 +129,7 @@ &-navbar { overflow: hidden; - background-color: rgba(0, 0, 0, .5); + background-color: @btn-background-color; } @viewer-list-item-width: 30px; @@ -134,4 +165,56 @@ &-transition { transition: all .3s ease-out; } +} + +@icon-prefix-cls: react-viewer-icon; + +.@{icon-prefix-cls} { + & { + font-family: 'icomoon' !important; + display: inline-block; + font-style: normal; + vertical-align: baseline; + text-align: center; + text-transform: none; + text-rendering: auto; + line-height: 1; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + color: white; + font-size: 13px; + } + + &-zoomIn:before { + content: '\ea0a'; + } + + &-zoomOut:before { + content: '\ea0b'; + } + + &-prev:before { + content: '\ea38'; + } + + &-next:before { + content: '\ea34'; + } + + &-close:before { + content: '\ea0f'; + } + + &-rotateLeft:before { + content: '\e967'; + } + + &-rotateRight:before { + content: '\e968'; + } + + &-reset:before { + content: '\e984'; + } } \ No newline at end of file