1.0.0-alpha.6 • Published 1 year ago

@hey-mirror/clock v1.0.0-alpha.6

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

@hey-mirror/clock

Example

import styled from '@emotion/styled';
import { Clock } from '@hey-mirror/today';

const Wrapper = styled.div({
  display: 'flex',
  flexDirection: 'column',
  gap: 8,
});

export const Display = () => (
  <Clock
    hour12
    locale='en-US'
  >
    <Clock.Hours />:<Clock.Minutes/>.<Clock.Seconds>{' '}
    <Clock.Period>
      <Clock.Period.AM>
        am
      </Clock.Period.AM>
      <Clock.Period.PM>
        pm
      </Clock.Period.PM>
    </Clock.Period>
  </Clock>
);

API

<Clock />

PropDefaultTypeDescription
children-ReactNode
localeen-USstringJavascript Date locale

<Hours />

PropDefaultTypeDescription
className-string
lengthnumericnumeric or 2-digit

<Hours /> will handle hour12 if set on <Clock />.


<Minutes />

PropDefaultTypeDescription
className-string
length2-digitnumeric or 2-digit

<Seconds />

PropDefaultTypeDescription
children<Period.AM /><Period.PM />ReactNode
length2-digitnumeric or 2-digit

<Period />

PropDefaultTypeDescription
children<Period.AM /><Period.PM />ReactNode

Only renders if hour12 is set on <Clock />.

or you can customize both displays:

<Time.Period>
  <Time.Period.AM>a.m.</Time.Period.AM>
  <Time.Period.PM>p.m.</Time.Period.PM>
</Time.Period>

Include both <Time.Period.AM /> and <Time.Period.PM /> — only the correct one will be rendered.


<Period.AM /> and <Period.PM />

PropDefaultTypeDescription
childrenAM or PMReactNode
className-string
1.0.0-alpha.6

1 year ago

1.0.0-alpha.5

1 year ago

1.0.0-alpha.4

1 year ago

1.0.0-alpha.3

1 year ago

1.0.0-alpha.2

1 year ago

1.0.0-alpha.1

1 year ago