Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Clock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default class Clock extends Component {
<Mark
angle={i * 30}
key={`hour_${i}`}
number={this.props.showNumber ? i : null}
length={hourMarksLength}
name="hour"
width={hourMarksWidth}
Expand Down Expand Up @@ -222,6 +223,7 @@ Clock.propTypes = {
secondHandOppositeLength: isOppositeHandLength,
secondHandWidth: isHandWidth,
size: PropTypes.number,
showNumber: PropTypes.bool,
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.instanceOf(Date),
Expand Down
9 changes: 8 additions & 1 deletion src/Clock.less
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,18 @@
background-color: black;
transform: translateX(-50%);
}

&__number {
position: absolute;
left: -40px;
width: 80px;
text-align: center;
}
}

&__second-hand {
&__body {
background-color: red;
}
}
}
}
15 changes: 15 additions & 0 deletions src/Mark.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Mark = ({
length,
name,
width,
number,
}) => (
<div
className={`react-clock__mark react-clock__${name}-mark`}
Expand All @@ -23,6 +24,19 @@ const Mark = ({
bottom: `${100 - (length / 2)}%`,
}}
/>

{number &&
<div
className="react-clock__mark__number"
style={{
transform: `rotate(-${angle}deg)`,
top: `${length / 2}%`,
}}
>
{number}
</div>
}

</div>
);

Expand All @@ -37,6 +51,7 @@ Mark.propTypes = {
length: isMarkLength,
name: PropTypes.string.isRequired,
width: isMarkWidth,
number: PropTypes.number,
};

export default Mark;
1 change: 1 addition & 0 deletions src/entry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Clock from './Clock';

/* eslint-disable */
import './Clock.css';

export default Clock;
Expand Down