@omniumretail/component-library 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/preview.js +1 -0
- package/dist/types/components/Footer/Footer.stories.d.ts +5 -0
- package/dist/types/components/Footer/index.d.ts +5 -0
- package/package.json +2 -1
- package/src/assets/images/omnium-retail-logo-white.png +0 -0
- package/src/components/Footer/Footer.stories.tsx +14 -0
- package/src/components/Footer/index.tsx +38 -0
- package/src/components/Footer/styles.module.scss +38 -0
package/.storybook/preview.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omniumretail/component-library",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/bundle.js",
|
|
6
6
|
"typings": "./dist/types/index",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"jest-resolve": "^27.4.2",
|
|
45
45
|
"jest-watch-typeahead": "^1.0.0",
|
|
46
46
|
"mini-css-extract-plugin": "^2.7.2",
|
|
47
|
+
"moment": "^2.29.4",
|
|
47
48
|
"postcss": "^8.4.4",
|
|
48
49
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
49
50
|
"postcss-loader": "^6.2.1",
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { Footer, FooterProps } from '.';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Footer',
|
|
6
|
+
component: Footer,
|
|
7
|
+
} as Meta;
|
|
8
|
+
|
|
9
|
+
const Template: Story<FooterProps> = (args) => <Footer {...args}></Footer>;
|
|
10
|
+
|
|
11
|
+
export const Primary = Template.bind({});
|
|
12
|
+
Primary.args = {
|
|
13
|
+
storeName: 'Levis'
|
|
14
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import styles from './styles.module.scss';
|
|
4
|
+
import omniumLogo from '../../assets/images/omnium-retail-logo-white.png';
|
|
5
|
+
|
|
6
|
+
export interface FooterProps {
|
|
7
|
+
storeName: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Footer = (props: FooterProps) => {
|
|
11
|
+
const [date, setDate] = useState(moment());
|
|
12
|
+
const { storeName = 'Missing Store Name' } = props;
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const time = (function updateDate() {
|
|
16
|
+
const nextMinute = moment().add(1, 'minute');
|
|
17
|
+
return setTimeout(() => {
|
|
18
|
+
setDate(moment());
|
|
19
|
+
updateDate();
|
|
20
|
+
}, nextMinute.valueOf() - moment().valueOf());
|
|
21
|
+
}());
|
|
22
|
+
|
|
23
|
+
return () => clearTimeout(time);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className={styles.footer}>
|
|
28
|
+
<div className={styles.content}>
|
|
29
|
+
<div className={styles.brand}>{storeName}</div>
|
|
30
|
+
<div className={styles.date}>{date.format('DD/MM/yyyy')}</div>
|
|
31
|
+
<div className={styles.time}>{date.format('HH:mm')}</div>
|
|
32
|
+
</div>
|
|
33
|
+
<img src={omniumLogo} className={styles.omniumLogoImg} alt="omnium logo" />
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.footer {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
align-items: center;
|
|
5
|
+
flex-wrap: nowrap;
|
|
6
|
+
gap: 0 16px;
|
|
7
|
+
background-color: var(--color-black);
|
|
8
|
+
position: fixed;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
width: 100%;
|
|
11
|
+
padding: 12px 24px;
|
|
12
|
+
font-size: var(--font-size-body-1);
|
|
13
|
+
color: var(--color-grey-light);
|
|
14
|
+
height: 60px;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
text-align: left;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
|
|
19
|
+
.brand {
|
|
20
|
+
color: var(--grey2);
|
|
21
|
+
width: 100%;
|
|
22
|
+
margin-bottom: 4px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.time {
|
|
26
|
+
margin-left: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.date,
|
|
30
|
+
.time {
|
|
31
|
+
display: inline-block;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.omniumLogoImg {
|
|
35
|
+
height: 25px;
|
|
36
|
+
align-self: flex-end;
|
|
37
|
+
}
|
|
38
|
+
}
|