-
Notifications
You must be signed in to change notification settings - Fork 696
/
Copy pathversion.tsx
50 lines (41 loc) · 1.22 KB
/
version.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import React from 'react'
import { cssClass, Text, Box } from '@adminjs/design-system'
import { styled } from '@adminjs/design-system/styled-components'
import { VersionProps } from '../../../adminjs-options.interface.js'
import { useTranslation } from '../../hooks/index.js'
import allowOverride from '../../hoc/allow-override.js'
export type Props = {
versions: VersionProps;
}
const VersionItem = styled(Text)`
padding: 12px 24px 12px 0;
`
VersionItem.defaultProps = {
display: ['none', 'block'],
color: 'grey100',
}
const Version: React.FC<Props> = (props) => {
const { versions } = props
const { admin, app } = versions
const { translateLabel } = useTranslation()
return (
<Box flex flexGrow={1} py="default" px="xxl" className={cssClass('Version')} data-css="version">
{admin && (
<VersionItem>
{translateLabel('adminVersion', { version: admin })}
</VersionItem>
)}
{app && (
<VersionItem>
{translateLabel('appVersion', { version: app })}
</VersionItem>
)}
</Box>
)
}
const OverridableVersion = allowOverride(Version, 'Version')
export {
OverridableVersion as default,
OverridableVersion as Version,
Version as OriginalVersion,
}