@ta-interaktiv/react-publication-info v2.0.0
React Publication Info
Displays publication meta data (like publication and update date as well as version number).
API
Table of Contents
NameValueItem
Generic key-value component.
Parameters
propsobjectprops.namestring? The name or key of the information.props.valuestring? The value. If null or undefined, the component will not render.props.itemClassNamestring? Class name(s) for the whole item. (optional, default'')props.nameClassNamestring? Class names(s) for the key part. (optional, default'')props.valueClassNamestring? Class names(s) for the value part. (optional, default'')
Examples
import { NameValueItem }from '@ta-interaktiv/react-publication-info'
function Component(props) {
return(
<NameValueItem
name='Version'
value='1.0.0'
itemClassName='ui label'
valueClassName='detail'
/>
)
}
// returns <span className="name-value-item ui label">
// <span className="name ">Version</span>
// <span className="value detail">1.0.0</span>
// </span>Returns (React.Element<any> | null)
PublicationInfo
Show all information regarding a publication: when it has been first published, when it was updated, and what version it is.
Parameters
propsobjectprops.publicationDatestring Unix timestamp when the project has been first published (optional, defaultwindow.project.publicationDate)props.changeDatestring Unix timestamp when the project has been last updated. (optional, defaultwindow.project.changeDate)props.versionstring Version number of the project (optional, defaultwindow.project.version)props.classNamestring? CSS class name of the whole object. (optional, default'')props.itemClassNamestring? CSS class names for the individual items. (optional, default'')props.nameClassNamestring? CSS class names for the key/name of the individual items. (optional, default'')props.valueClassNamestring? CSS class names for the value of the individual items. (optional, default'')
Returns React.Element<any>
TimestampFormatter
- See: NameValueItem for additional className parameters to be passed into this component.
Provides a formatted timestamp, with an optional prefix. Modeled after the common article suffix on tagesanzeiger.ch articles, it will return something like "Erstellt: 25.07.2017, 11:47 Uhr" with the appropriate prefix.
Parameters
propsobject
Examples
import { TimestampFormatter } from '@ta-interaktiv/react-publication-date'
function Component (props) {
return (
<TimestampFormatter prefix='Erstellt:' timestamp={1500986249} />
)
}Returns (Element<any> | null)
VersionFormatter
- See: NameValueItem for additional
classNameprops that can be passed in.
Provides a formatted version, with an optional prefix.
Parameters
propsobject
Examples
import { VersionFormatter } from '@ta-interaktiv/react-publication-date'
function Component (props) {
return (
<VersionFormatter version='1.0.0' />
)
}Returns (React.Element<any> | null)
Contributing
Development
Code resides in /src. Test cases are provided
using Storybook. Add test cases in
/stories/index.js,
and run them with
yarn run storybookThey will appear on http://localhost:9001.
This repository follows the Standard JS style. To fix your code, run
yarn run fixBuilding & Releasing
Babel is used to provide ES5 compatible code. To compile run
yarn run distChanges should go into the changelog. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Update the Readme with the current API using
yarn run docs6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago