trepur_components 1.0.2 → 1.0.3
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/dist/src/lib/components/Carousel/index.d.ts +0 -1
- package/dist/src/lib/components/Carousel/index.js +1 -1
- package/dist/src/lib/components/Carousel/index.js.map +1 -1
- package/dist/src/lib/components/FooterBar/{footerBar.stories.d.ts → FooterBar.stories.d.ts} +0 -0
- package/dist/src/lib/components/FooterBar/{footerBar.stories.js → FooterBar.stories.js} +1 -1
- package/dist/src/lib/components/FooterBar/{footerBar.stories.js.map → FooterBar.stories.js.map} +1 -1
- package/dist/src/lib/components/Nav/index.js +2 -2
- package/dist/src/lib/components/Nav/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/Accordion/Accordion.stories.tsx +0 -88
- package/dist/components/Accordion/index.tsx +0 -31
- package/dist/components/AlertBar/AlertBar.stories.tsx +0 -105
- package/dist/components/AlertBar/index.tsx +0 -127
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -60
- package/dist/components/Breadcrumbs/index.tsx +0 -55
- package/dist/components/BreadcrumbsBordered/BreadcrumbsBordered.stories.tsx +0 -52
- package/dist/components/BreadcrumbsBordered/index.tsx +0 -44
- package/dist/components/BreadcrumbsItem/BreadcrumbsItem.stories.tsx +0 -54
- package/dist/components/BreadcrumbsItem/index.tsx +0 -151
- package/dist/components/Button/button.stories.tsx +0 -148
- package/dist/components/Button/index.tsx +0 -91
- package/dist/components/Card/Card.stories.tsx +0 -150
- package/dist/components/Card/index.tsx +0 -162
- package/dist/components/CardWithTopImage/CardWithTopImage.stories.tsx +0 -48
- package/dist/components/CardWithTopImage/index.tsx +0 -40
- package/dist/components/Carousel/Carousel.stories.tsx +0 -369
- package/dist/components/Carousel/index.tsx +0 -267
- package/dist/components/ChevronCard/ChevronCard.stories.tsx +0 -21
- package/dist/components/ChevronCard/index.tsx +0 -39
- package/dist/components/Collapsible/Collapsible.stories.tsx +0 -70
- package/dist/components/Collapsible/index.tsx +0 -124
- package/dist/components/Column/Column.stories.tsx +0 -82
- package/dist/components/Column/index.tsx +0 -114
- package/dist/components/Container/Container.stories.tsx +0 -38
- package/dist/components/Container/index.tsx +0 -30
- package/dist/components/FooterBar/FooterBar.stories.tsx +0 -57
- package/dist/components/FooterBar/index.tsx +0 -44
- package/dist/components/Form/Form.stories.tsx +0 -93
- package/dist/components/Form/index.tsx +0 -58
- package/dist/components/FyreCard/FyreCard.stories.tsx +0 -29
- package/dist/components/FyreCard/index.tsx +0 -46
- package/dist/components/Greeting/Greeting.stories.tsx +0 -42
- package/dist/components/Greeting/index.tsx +0 -46
- package/dist/components/HamburgerIcon/HamburgerIcon.stories.tsx +0 -50
- package/dist/components/HamburgerIcon/index.tsx +0 -65
- package/dist/components/Icon/Icon.stories.tsx +0 -102
- package/dist/components/Icon/index.tsx +0 -112
- package/dist/components/Image/Image.stories.tsx +0 -88
- package/dist/components/Image/index.tsx +0 -113
- package/dist/components/ImageLink/ImageLink.stories.tsx +0 -60
- package/dist/components/ImageLink/index.tsx +0 -62
- package/dist/components/ImageLinkList/ImageLinkList.stories.tsx +0 -34
- package/dist/components/ImageLinkList/index.tsx +0 -33
- package/dist/components/InformationIcon/InformationIcon.stories.tsx +0 -86
- package/dist/components/InformationIcon/index.tsx +0 -84
- package/dist/components/Input/Input.stories.tsx +0 -99
- package/dist/components/Input/index.tsx +0 -126
- package/dist/components/Jumbotron/Jumbotron.stories.tsx +0 -22
- package/dist/components/Jumbotron/index.tsx +0 -25
- package/dist/components/Nav/Nav.stories.tsx +0 -155
- package/dist/components/Nav/index.tsx +0 -180
- package/dist/components/NavItem/NavItem.stories.tsx +0 -89
- package/dist/components/NavItem/index.tsx +0 -65
- package/dist/components/NewsCard/NewsCard.stories.tsx +0 -71
- package/dist/components/NewsCard/index.tsx +0 -48
- package/dist/components/Profile/Profile.stories.tsx +0 -50
- package/dist/components/Profile/index.tsx +0 -87
- package/dist/components/Row/Row.stories.tsx +0 -51
- package/dist/components/Row/index.tsx +0 -24
- package/dist/components/Search/Search.stories.tsx +0 -58
- package/dist/components/Search/index.tsx +0 -58
- package/dist/components/SocialBlock/SocialBlock.stories.tsx +0 -114
- package/dist/components/SocialBlock/index.tsx +0 -161
- package/dist/components/StarRating/StarRating.stories.tsx +0 -23
- package/dist/components/StarRating/index.tsx +0 -71
- package/dist/components/Testimonial/Testimonial.stories.tsx +0 -110
- package/dist/components/Testimonial/index.tsx +0 -50
- package/dist/components/TextAndTitle/TextAndTitle.stories.tsx +0 -65
- package/dist/components/TextAndTitle/index.tsx +0 -257
- package/dist/components/TextArea/TextArea.stories.tsx +0 -67
- package/dist/components/TextArea/index.tsx +0 -97
- package/dist/components/Timeline/Timeline.stories.tsx +0 -100
- package/dist/components/Timeline/index.css +0 -133
- package/dist/components/Timeline/index.tsx +0 -315
- package/dist/components/Tubestops/Tubestops.stories.tsx +0 -66
- package/dist/components/Tubestops/index.css +0 -92
- package/dist/components/Tubestops/index.tsx +0 -77
- package/dist/components/UserIcon/UserIcon.stories.tsx +0 -67
- package/dist/components/UserIcon/index.tsx +0 -42
- package/dist/components/Video/Video.stories.tsx +0 -23
- package/dist/components/Video/index.tsx +0 -49
- package/dist/fonts/Sora/OFL.txt +0 -93
- package/dist/fonts/Sora/README.txt +0 -70
- package/dist/fonts/Sora/Sora-VariableFont_wght.ttf +0 -0
- package/dist/fonts/Sora/static/Sora-Bold.ttf +0 -0
- package/dist/fonts/Sora/static/Sora-ExtraBold.ttf +0 -0
- package/dist/fonts/Sora/static/Sora-ExtraLight.ttf +0 -0
- package/dist/fonts/Sora/static/Sora-Light.ttf +0 -0
- package/dist/fonts/Sora/static/Sora-Medium.ttf +0 -0
- package/dist/fonts/Sora/static/Sora-Regular.ttf +0 -0
- package/dist/fonts/Sora/static/Sora-SemiBold.ttf +0 -0
- package/dist/fonts/Sora/static/Sora-Thin.ttf +0 -0
- package/dist/index.js +0 -272
- package/dist/styles/base.css +0 -73
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import classNames from 'classnames'
|
|
3
|
-
import Button from '@components/Button'
|
|
4
|
-
|
|
5
|
-
export interface Props extends Partial<Pick<HTMLElement, 'className' | 'id'>> {
|
|
6
|
-
opened?: boolean
|
|
7
|
-
onClick?: React.MouseEventHandler
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const HamburgerIcon = ({
|
|
11
|
-
id,
|
|
12
|
-
className,
|
|
13
|
-
onClick
|
|
14
|
-
}: Props): JSX.Element => {
|
|
15
|
-
const [opened, setOpened] = useState(false)
|
|
16
|
-
const lineOneClassList = classNames({
|
|
17
|
-
'origin-top-left rotate-45 translate-x-1 -translate-y-0.5': opened
|
|
18
|
-
}, 'origin-top-left transition-transform duration-200 ease-linear')
|
|
19
|
-
|
|
20
|
-
const lineTwoClassList = classNames({
|
|
21
|
-
'opacity-0': opened
|
|
22
|
-
}, 'opacity-100 transition-opacity duration-200 ease-linear')
|
|
23
|
-
|
|
24
|
-
const lineThreeClassList = classNames({
|
|
25
|
-
'origin-bottom-left -rotate-45 translate-x-1 translate-y-px': opened
|
|
26
|
-
}, 'origin-bottom-left transition-transform duration-200 ease-linear')
|
|
27
|
-
|
|
28
|
-
const toggleOpened = (e: any): void => {
|
|
29
|
-
setOpened(!opened)
|
|
30
|
-
onClick?.(e)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Button
|
|
35
|
-
id={id}
|
|
36
|
-
className={className}
|
|
37
|
-
onClick={(e) => toggleOpened(e)}
|
|
38
|
-
variant='primary'
|
|
39
|
-
type='icon'
|
|
40
|
-
>
|
|
41
|
-
<svg
|
|
42
|
-
className='mx-auto overflow-visible fill-white group-hover:fill-primary transition-backgroundColor duration-500 transform'
|
|
43
|
-
width='24'
|
|
44
|
-
height='24'
|
|
45
|
-
viewBox='0 0 24 15'
|
|
46
|
-
xmlns='http://www.w3.org/2000/svg'
|
|
47
|
-
>
|
|
48
|
-
<path
|
|
49
|
-
className={lineOneClassList}
|
|
50
|
-
d='M0 1.5C0 0.947715 0.447715 0.5 1 0.5H21C21.5523 0.5 22 0.947715 22 1.5C22 2.05228 21.5523 2.5 21 2.5H1C0.447716 2.5 0 2.05228 0 1.5Z'
|
|
51
|
-
/>
|
|
52
|
-
<path
|
|
53
|
-
className={lineTwoClassList}
|
|
54
|
-
d='M0 7.5C0 6.94772 0.447715 6.5 1 6.5H21C21.5523 6.5 22 6.94772 22 7.5C22 8.05228 21.5523 8.5 21 8.5H1C0.447716 8.5 0 8.05228 0 7.5Z'
|
|
55
|
-
/>
|
|
56
|
-
<path
|
|
57
|
-
className={lineThreeClassList}
|
|
58
|
-
d='M0 13.5C0 12.9477 0.447715 12.5 1 12.5H21C21.5523 12.5 22 12.9477 22 13.5C22 14.0523 21.5523 14.5 21 14.5H1C0.447716 14.5 0 14.0523 0 13.5Z'
|
|
59
|
-
/>
|
|
60
|
-
</svg>
|
|
61
|
-
</Button>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export default HamburgerIcon
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import Icon from './index'
|
|
3
|
-
import { idAndClassName } from '@utils/controls'
|
|
4
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
|
5
|
-
|
|
6
|
-
const componentMeta: ComponentMeta<typeof Icon> = {
|
|
7
|
-
title: 'Trepur Components/Rupert Bennett/Atoms/Icon',
|
|
8
|
-
component: Icon,
|
|
9
|
-
argTypes: {
|
|
10
|
-
...idAndClassName,
|
|
11
|
-
type: {
|
|
12
|
-
options: ['heart', 'arrow-up', 'arrow-down', 'multiply', 'burger', 'bars'],
|
|
13
|
-
type: { name: 'string', required: false },
|
|
14
|
-
description: 'The name of the icon to display in the component',
|
|
15
|
-
table: {
|
|
16
|
-
type: { summary: 'string' }
|
|
17
|
-
},
|
|
18
|
-
control: 'select'
|
|
19
|
-
},
|
|
20
|
-
size: {
|
|
21
|
-
type: { name: 'number', required: false },
|
|
22
|
-
description: 'The size of the icon to show in the component',
|
|
23
|
-
table: {
|
|
24
|
-
type: { summary: 'number' }
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
animation: {
|
|
28
|
-
type: { name: 'string', required: false },
|
|
29
|
-
options: ['none', 'pulse', 'spin', 'beat'],
|
|
30
|
-
description: 'Type of annimation to apply to the component',
|
|
31
|
-
table: {
|
|
32
|
-
type: { summary: 'string' }
|
|
33
|
-
},
|
|
34
|
-
control: 'select'
|
|
35
|
-
},
|
|
36
|
-
reverseSpin: {
|
|
37
|
-
type: { name: 'boolean', required: false },
|
|
38
|
-
description: 'To reverse the animation on the component',
|
|
39
|
-
table: {
|
|
40
|
-
type: { summary: 'boolean' }
|
|
41
|
-
},
|
|
42
|
-
defaultValue: 'false'
|
|
43
|
-
},
|
|
44
|
-
hollow: {
|
|
45
|
-
type: { name: 'boolean', required: false },
|
|
46
|
-
description: 'To render a hollow version of the icon in component',
|
|
47
|
-
table: {
|
|
48
|
-
type: { summary: 'boolean' }
|
|
49
|
-
},
|
|
50
|
-
defaultValue: 'false'
|
|
51
|
-
},
|
|
52
|
-
colour: {
|
|
53
|
-
type: { name: 'string', required: false },
|
|
54
|
-
options: ['primary', 'secondary', 'white', 'black', 'gold'],
|
|
55
|
-
description: 'The font colour of the component',
|
|
56
|
-
table: {
|
|
57
|
-
type: { summary: 'string' }
|
|
58
|
-
},
|
|
59
|
-
defaultValue: 'primary',
|
|
60
|
-
control: 'select'
|
|
61
|
-
},
|
|
62
|
-
bgColour: {
|
|
63
|
-
type: { name: 'string', required: false },
|
|
64
|
-
options: ['primary', 'secondary', 'white', 'black', 'gold'],
|
|
65
|
-
description: 'The background colour of the component',
|
|
66
|
-
table: {
|
|
67
|
-
type: { summary: 'string' }
|
|
68
|
-
},
|
|
69
|
-
defaultValue: 'secondary',
|
|
70
|
-
control: 'select'
|
|
71
|
-
},
|
|
72
|
-
rounded: {
|
|
73
|
-
type: { name: 'boolean', required: false },
|
|
74
|
-
description: 'Sets the component to a circle shape',
|
|
75
|
-
table: {
|
|
76
|
-
type: { summary: 'boolean' }
|
|
77
|
-
},
|
|
78
|
-
defaultValue: 'false'
|
|
79
|
-
},
|
|
80
|
-
brand: {
|
|
81
|
-
type: { name: 'boolean', required: false },
|
|
82
|
-
description: 'Set to true if the icon type to render is a brand image',
|
|
83
|
-
table: {
|
|
84
|
-
type: { summary: 'boolean' }
|
|
85
|
-
},
|
|
86
|
-
defaultValue: 'false'
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
args: {
|
|
90
|
-
type: 'heart',
|
|
91
|
-
size: 3,
|
|
92
|
-
animation: 'none',
|
|
93
|
-
hoverBgColour: 'primary',
|
|
94
|
-
hoverColour: 'secondary'
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const Template: ComponentStory<typeof Icon> = (args) => <Icon {...args} />
|
|
99
|
-
|
|
100
|
-
export const _Icon = Template.bind({})
|
|
101
|
-
|
|
102
|
-
export default componentMeta
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import classNames from 'classnames'
|
|
3
|
-
import { Colours } from '@utils/controls'
|
|
4
|
-
|
|
5
|
-
export interface Props {
|
|
6
|
-
id?: string
|
|
7
|
-
className?: string
|
|
8
|
-
type: string
|
|
9
|
-
size?: number
|
|
10
|
-
animation?: 'pulse' | 'none'
|
|
11
|
-
reverseSpin?: boolean
|
|
12
|
-
hollow?: boolean
|
|
13
|
-
colour?: Colours
|
|
14
|
-
bgColour?: Colours
|
|
15
|
-
hoverColour?: Colours
|
|
16
|
-
hoverBgColour?: Colours
|
|
17
|
-
rounded?: boolean
|
|
18
|
-
brand?: boolean
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const Icon = ({
|
|
22
|
-
id,
|
|
23
|
-
className,
|
|
24
|
-
type,
|
|
25
|
-
size = 1,
|
|
26
|
-
animation = 'none',
|
|
27
|
-
reverseSpin = false,
|
|
28
|
-
hollow = false,
|
|
29
|
-
colour = 'primary',
|
|
30
|
-
bgColour = 'secondary',
|
|
31
|
-
hoverColour = 'primary',
|
|
32
|
-
hoverBgColour = 'secondary',
|
|
33
|
-
rounded = false,
|
|
34
|
-
brand = false
|
|
35
|
-
}: Props): JSX.Element => {
|
|
36
|
-
const fontColour: { [key in Colours]: string } = {
|
|
37
|
-
primary: 'text-primary',
|
|
38
|
-
secondary: 'text-secondary',
|
|
39
|
-
white: 'text-white',
|
|
40
|
-
black: 'text-black',
|
|
41
|
-
gold: 'text-gold'
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const backgroundColour: { [key in Colours]: string } = {
|
|
45
|
-
primary: 'bg-primary',
|
|
46
|
-
secondary: 'bg-secondary',
|
|
47
|
-
white: 'bg-white',
|
|
48
|
-
black: 'bg-black',
|
|
49
|
-
gold: 'bg-gold'
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const hoverFontColour: { [key in Colours]: string } = {
|
|
53
|
-
primary: 'group-hover:text-primary',
|
|
54
|
-
secondary: 'group-hover:text-secondary',
|
|
55
|
-
white: 'group-hover:text-white',
|
|
56
|
-
black: 'group-hover:text-black',
|
|
57
|
-
gold: 'group-hover:text-gold'
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const hoverBackgroundColour: { [key in Colours]: string } = {
|
|
61
|
-
primary: 'group-hover:bg-primary',
|
|
62
|
-
secondary: 'group-hover:bg-secondary',
|
|
63
|
-
white: 'group-hover:bg-white',
|
|
64
|
-
black: 'group-hover:bg-black',
|
|
65
|
-
gold: 'group-hover:bg-gold'
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const wrapperClassList = classNames({
|
|
69
|
-
'w-6 h-6': size === 1,
|
|
70
|
-
'w-10 h-10': size === 2,
|
|
71
|
-
'w-14 h-14': size === 3,
|
|
72
|
-
'w-20 h-20': size === 4,
|
|
73
|
-
'w-24 h-24': size === 5,
|
|
74
|
-
'w-28 h-28': size === 6,
|
|
75
|
-
'w-32 h-32': size === 7,
|
|
76
|
-
'w-36 h-36': size === 8,
|
|
77
|
-
'w-40 h-40': size === 9,
|
|
78
|
-
'w-44 h-44': size === 10,
|
|
79
|
-
'rounded-full': rounded
|
|
80
|
-
},
|
|
81
|
-
className,
|
|
82
|
-
backgroundColour[bgColour],
|
|
83
|
-
fontColour[colour],
|
|
84
|
-
hoverBackgroundColour[hoverBgColour],
|
|
85
|
-
hoverFontColour[hoverColour],
|
|
86
|
-
'flex transition-backgroundColor duration-500 transform'
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
const classList = classNames({
|
|
90
|
-
'fa-brands': brand,
|
|
91
|
-
[`fa-${size}x`]: size,
|
|
92
|
-
[`fa-${animation}`]: animation,
|
|
93
|
-
'fa-spin-reverse': reverseSpin,
|
|
94
|
-
'fa-regular': hollow
|
|
95
|
-
}, `fa fa-${type} mx-auto my-auto`)
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<div
|
|
99
|
-
id={id}
|
|
100
|
-
className={wrapperClassList}
|
|
101
|
-
>
|
|
102
|
-
<span
|
|
103
|
-
className={classList}
|
|
104
|
-
role='img'
|
|
105
|
-
aria-hidden='true'
|
|
106
|
-
aria-label={type}
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export default Icon
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import Image from '.'
|
|
3
|
-
import { idAndClassName } from '@utils/controls'
|
|
4
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
|
5
|
-
import logo from '@assets/images/primary-logo.png'
|
|
6
|
-
|
|
7
|
-
const componentMeta: ComponentMeta<typeof Image> = {
|
|
8
|
-
title: 'Trepur Components/Rupert Bennett/Atoms/Image',
|
|
9
|
-
component: Image,
|
|
10
|
-
argTypes: {
|
|
11
|
-
...idAndClassName,
|
|
12
|
-
image: {
|
|
13
|
-
type: { name: 'string', required: false },
|
|
14
|
-
description: 'The image to display on the component',
|
|
15
|
-
table: {
|
|
16
|
-
type: { summary: 'default' }
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
altText: {
|
|
20
|
-
type: { name: 'string', required: false },
|
|
21
|
-
description: 'The accessibility alt text for the image on the component',
|
|
22
|
-
table: {
|
|
23
|
-
type: { summary: 'default' }
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
title: {
|
|
27
|
-
type: { name: 'string', required: false },
|
|
28
|
-
description: 'The accessibility title for the image on the component',
|
|
29
|
-
table: {
|
|
30
|
-
type: { summary: 'default' }
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
rounded: {
|
|
34
|
-
type: { name: 'boolean', required: false },
|
|
35
|
-
description: 'Sets the corners of the component to rounded',
|
|
36
|
-
table: {
|
|
37
|
-
type: { summary: 'boolean' }
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
roundedFull: {
|
|
41
|
-
type: { name: 'boolean', required: false },
|
|
42
|
-
description: 'Sets the component to a circle shape',
|
|
43
|
-
table: {
|
|
44
|
-
type: { summary: 'boolean' }
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
height: {
|
|
48
|
-
type: { name: 'number', required: false },
|
|
49
|
-
description: 'Defines the height of the component',
|
|
50
|
-
table: {
|
|
51
|
-
type: { summary: 'number' }
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
width: {
|
|
55
|
-
type: { name: 'number', required: false },
|
|
56
|
-
description: 'Defines the width of the component',
|
|
57
|
-
table: {
|
|
58
|
-
type: { summary: 'number' }
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
overlayText: {
|
|
62
|
-
type: { name: 'string', required: false },
|
|
63
|
-
description: 'The text to show when hovering over the component',
|
|
64
|
-
table: {
|
|
65
|
-
type: { summary: 'default' }
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
centerAligned: {
|
|
69
|
-
type: { name: 'boolean', required: false },
|
|
70
|
-
description: 'Sets the component to the center',
|
|
71
|
-
table: {
|
|
72
|
-
type: { summary: 'boolean' }
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
args: {
|
|
77
|
-
image: logo,
|
|
78
|
-
height: 8,
|
|
79
|
-
width: 8,
|
|
80
|
-
overlayText: 'logo'
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const Template: ComponentStory<typeof Image> = (args) => <Image {...args} />
|
|
85
|
-
|
|
86
|
-
export const _Image = Template.bind({})
|
|
87
|
-
|
|
88
|
-
export default componentMeta
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import classNames from 'classnames'
|
|
3
|
-
|
|
4
|
-
export interface Props {
|
|
5
|
-
id?: string
|
|
6
|
-
className?: string
|
|
7
|
-
image?: string
|
|
8
|
-
altText?: string
|
|
9
|
-
title?: string
|
|
10
|
-
rounded?: boolean
|
|
11
|
-
roundedFull?: boolean
|
|
12
|
-
height?: number
|
|
13
|
-
width?: number
|
|
14
|
-
overlayText?: string
|
|
15
|
-
centerAligned?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const Image = ({
|
|
19
|
-
id,
|
|
20
|
-
className,
|
|
21
|
-
image,
|
|
22
|
-
altText,
|
|
23
|
-
title,
|
|
24
|
-
rounded = false,
|
|
25
|
-
roundedFull = false,
|
|
26
|
-
height = 8,
|
|
27
|
-
width = 8,
|
|
28
|
-
overlayText,
|
|
29
|
-
centerAligned = false
|
|
30
|
-
}: Props): JSX.Element => {
|
|
31
|
-
const [isHovering, setIsHovering] = useState(false)
|
|
32
|
-
const opacity = classNames({
|
|
33
|
-
'opacity-80': isHovering,
|
|
34
|
-
'opacity-0': !isHovering
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const widthClassList = classNames({
|
|
38
|
-
'w-6': width === 1,
|
|
39
|
-
'w-10': width === 2,
|
|
40
|
-
'w-14': width === 3,
|
|
41
|
-
'w-16': width === 4,
|
|
42
|
-
'w-20': width === 5,
|
|
43
|
-
'w-24': width === 6,
|
|
44
|
-
'w-28': width === 7,
|
|
45
|
-
'w-32': width === 8,
|
|
46
|
-
'w-36': width === 9,
|
|
47
|
-
'w-40': width === 10,
|
|
48
|
-
'w-44': width === 11,
|
|
49
|
-
'w-full': (width === undefined) || (![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].includes(width))
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
const heightClassList = classNames({
|
|
53
|
-
'h-6': height === 1,
|
|
54
|
-
'h-10': height === 2,
|
|
55
|
-
'h-14': height === 3,
|
|
56
|
-
'h-16': height === 4,
|
|
57
|
-
'h-20': height === 5,
|
|
58
|
-
'h-24': height === 6,
|
|
59
|
-
'h-28': height === 7,
|
|
60
|
-
'h-32': height === 8,
|
|
61
|
-
'h-36': height === 9,
|
|
62
|
-
'h-40': height === 10,
|
|
63
|
-
'h-44': height === 11,
|
|
64
|
-
'h-full': (height === undefined) || (![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].includes(height))
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
const imageClassList = classNames({
|
|
68
|
-
'rounded-2xl': rounded,
|
|
69
|
-
'rounded-full': roundedFull,
|
|
70
|
-
'mx-auto': centerAligned
|
|
71
|
-
}, className, widthClassList, heightClassList)
|
|
72
|
-
|
|
73
|
-
const overlayClassList = classNames(
|
|
74
|
-
widthClassList,
|
|
75
|
-
heightClassList,
|
|
76
|
-
opacity,
|
|
77
|
-
'absolute z-10 transition-opacity duration-700 bg-white'
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
const overlayTextWrapperClassList = classNames(
|
|
81
|
-
widthClassList,
|
|
82
|
-
heightClassList,
|
|
83
|
-
opacity,
|
|
84
|
-
'flex absolute z-20 transition-opacity duration-700'
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
const overlayTextClassList = 'm-auto text-center text-primary'
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<>
|
|
91
|
-
{overlayText !== undefined &&
|
|
92
|
-
<>
|
|
93
|
-
<div className={overlayClassList} />
|
|
94
|
-
<div
|
|
95
|
-
className={overlayTextWrapperClassList}
|
|
96
|
-
onMouseEnter={() => setIsHovering(true)}
|
|
97
|
-
onMouseLeave={() => setIsHovering(false)}
|
|
98
|
-
>
|
|
99
|
-
<p className={overlayTextClassList}>{overlayText}</p>
|
|
100
|
-
</div>
|
|
101
|
-
</>}
|
|
102
|
-
<img
|
|
103
|
-
id={id}
|
|
104
|
-
className={imageClassList}
|
|
105
|
-
src={image}
|
|
106
|
-
{...(altText !== undefined && { alt: altText })}
|
|
107
|
-
{...(title !== undefined && { title })}
|
|
108
|
-
/>
|
|
109
|
-
</>
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export default Image
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { idAndClassName } from '@utils/controls'
|
|
3
|
-
import Column from '@components/Column'
|
|
4
|
-
import ImageLink from './index'
|
|
5
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
|
6
|
-
|
|
7
|
-
const componentMeta: ComponentMeta<typeof ImageLink> = {
|
|
8
|
-
title: 'Trepur Components/Other/Organisms/Image Link',
|
|
9
|
-
component: ImageLink,
|
|
10
|
-
parameters: {},
|
|
11
|
-
argTypes: {
|
|
12
|
-
...idAndClassName,
|
|
13
|
-
title: {
|
|
14
|
-
description: '',
|
|
15
|
-
control: 'text',
|
|
16
|
-
table: {
|
|
17
|
-
category: ''
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
image: {
|
|
21
|
-
description: '',
|
|
22
|
-
control: 'text',
|
|
23
|
-
table: {
|
|
24
|
-
category: ''
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
args: {
|
|
29
|
-
image: 'https://picsum.photos/400/400',
|
|
30
|
-
link: '/'
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const Template: ComponentStory<typeof ImageLink> = (args) => <Column sm={3} md={3}><ImageLink {...args} /></Column>
|
|
35
|
-
|
|
36
|
-
export const _ImageLink = Template.bind({})
|
|
37
|
-
_ImageLink.args = {}
|
|
38
|
-
|
|
39
|
-
export const _ImageLinkWithTitle = Template.bind({})
|
|
40
|
-
_ImageLinkWithTitle.args = {
|
|
41
|
-
title: 'Title'
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const _ImageLinkWithButton = Template.bind({})
|
|
45
|
-
_ImageLinkWithButton.args = {
|
|
46
|
-
buttonProps: {
|
|
47
|
-
children: 'Button 1'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const _ImageLinkRounded = Template.bind({})
|
|
52
|
-
_ImageLinkRounded.args = {
|
|
53
|
-
title: 'Title',
|
|
54
|
-
buttonProps: {
|
|
55
|
-
children: 'Button 1'
|
|
56
|
-
},
|
|
57
|
-
rounded: true
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export default componentMeta
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import Button, { Props as buttonProps } from '@components/Button'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
|
|
5
|
-
export interface Props {
|
|
6
|
-
id?: string
|
|
7
|
-
className?: string
|
|
8
|
-
image?: string
|
|
9
|
-
altText?: string
|
|
10
|
-
title?: string
|
|
11
|
-
link?: string
|
|
12
|
-
rounded?: boolean
|
|
13
|
-
openInNewTab?: boolean
|
|
14
|
-
buttonProps?: buttonProps
|
|
15
|
-
}
|
|
16
|
-
const ImageLink = ({
|
|
17
|
-
id,
|
|
18
|
-
className,
|
|
19
|
-
image,
|
|
20
|
-
altText,
|
|
21
|
-
title,
|
|
22
|
-
link,
|
|
23
|
-
rounded,
|
|
24
|
-
openInNewTab,
|
|
25
|
-
buttonProps
|
|
26
|
-
}: Props): JSX.Element => {
|
|
27
|
-
const classList = classNames(className, 'cursor-pointer lg:mx-3 md:mx-1 mx-1 lg:mb-5 md:mb-2 mb-2 hover:opacity-50 overflow-hidden text-center')
|
|
28
|
-
|
|
29
|
-
const roundedClass = classNames({
|
|
30
|
-
'rounded-full': rounded
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<a
|
|
35
|
-
id={id}
|
|
36
|
-
href={link}
|
|
37
|
-
{...(openInNewTab !== false && { target: 'blank' })}
|
|
38
|
-
>
|
|
39
|
-
<div className={roundedClass + ' ' + classList + ' relative overflow-hidden'}>
|
|
40
|
-
<img
|
|
41
|
-
src={image}
|
|
42
|
-
alt={altText}
|
|
43
|
-
className='object-cover w-full h-full'
|
|
44
|
-
/>
|
|
45
|
-
{title !== undefined &&
|
|
46
|
-
<h1
|
|
47
|
-
className='absolute bg-black text-white py-2 mt-4 top-0 inset-x-0 text-center'
|
|
48
|
-
>
|
|
49
|
-
{title}
|
|
50
|
-
</h1>}
|
|
51
|
-
{buttonProps?.children !== undefined &&
|
|
52
|
-
<Button
|
|
53
|
-
className='absolute mx-8 mb-4 bottom-0 inset-x-0 text-center'
|
|
54
|
-
>
|
|
55
|
-
{buttonProps.children}
|
|
56
|
-
</Button>}
|
|
57
|
-
</div>
|
|
58
|
-
</a>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default ImageLink
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { idAndClassName } from '@utils/controls'
|
|
3
|
-
import ImageLinkList, { Props as imageLinkListProps } from './index'
|
|
4
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
|
5
|
-
|
|
6
|
-
const getLinks = (): any => {
|
|
7
|
-
return new Array(16).fill(null).map(() => {
|
|
8
|
-
return {
|
|
9
|
-
image: 'https://picsum.photos/400/400',
|
|
10
|
-
title: 'Hi',
|
|
11
|
-
buttonProps: {
|
|
12
|
-
children: <p>button</p>
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const componentMeta: ComponentMeta<typeof ImageLinkList> = {
|
|
19
|
-
title: 'Trepur Components/Other/Organisms/Image Link List',
|
|
20
|
-
component: ImageLinkList,
|
|
21
|
-
parameters: {},
|
|
22
|
-
argTypes: {
|
|
23
|
-
...idAndClassName
|
|
24
|
-
},
|
|
25
|
-
args: {
|
|
26
|
-
items: getLinks()
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const Template: ComponentStory<typeof ImageLinkList> = (args) => <ImageLinkList {...args} />
|
|
31
|
-
|
|
32
|
-
export const _ImageLinkList = Template.bind({})
|
|
33
|
-
|
|
34
|
-
export default componentMeta
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import ImageLink, { Props as imageLinkProps } from '../ImageLink/index'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
|
|
5
|
-
export interface Props {
|
|
6
|
-
id?: string
|
|
7
|
-
className?: string
|
|
8
|
-
items?: Array<imageLinkProps>
|
|
9
|
-
}
|
|
10
|
-
const ImageLinkList = ({
|
|
11
|
-
id,
|
|
12
|
-
className,
|
|
13
|
-
items
|
|
14
|
-
}: Props): JSX.Element => {
|
|
15
|
-
const classList = classNames(className, 'grid md:grid-cols-4 sm:grid-cols-2')
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div id={id} className={classList}>
|
|
19
|
-
{items?.map((item, i: number) => {
|
|
20
|
-
return (
|
|
21
|
-
<ImageLink
|
|
22
|
-
key={`image_link_${i + 0}`}
|
|
23
|
-
altText='image'
|
|
24
|
-
image={item.image}
|
|
25
|
-
title={item.title}
|
|
26
|
-
/>
|
|
27
|
-
)
|
|
28
|
-
})}
|
|
29
|
-
</div>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default ImageLinkList
|