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 from 'react'
|
|
2
|
-
import TextAndTitle from './index'
|
|
3
|
-
import { action } from '@storybook/addon-actions'
|
|
4
|
-
import Greeting from '@components/Greeting'
|
|
5
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
|
6
|
-
|
|
7
|
-
const componentMeta: ComponentMeta<typeof TextAndTitle> = {
|
|
8
|
-
title: 'Trepur Components/Rupert Bennett/Organisms/Text And Title',
|
|
9
|
-
component: TextAndTitle,
|
|
10
|
-
argTypes: {
|
|
11
|
-
id: {
|
|
12
|
-
description: 'Defines the id of the component',
|
|
13
|
-
table: {
|
|
14
|
-
category: '',
|
|
15
|
-
type: { summary: 'string' },
|
|
16
|
-
defaultValue: { summary: 'undefined' }
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
className: {
|
|
20
|
-
description: 'Defines any additional classes for the components',
|
|
21
|
-
table: {
|
|
22
|
-
category: '',
|
|
23
|
-
type: { summary: 'string' },
|
|
24
|
-
defaultValue: { summary: 'undefined' }
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
onSave: {
|
|
28
|
-
type: { name: 'function', required: false },
|
|
29
|
-
description: 'Fires a function when you click save',
|
|
30
|
-
action: 'onClick',
|
|
31
|
-
table: {
|
|
32
|
-
type: {
|
|
33
|
-
summary: 'function'
|
|
34
|
-
},
|
|
35
|
-
defaultValue: { summary: 'undefined' }
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
args: {
|
|
40
|
-
children: <p>This is a child</p>,
|
|
41
|
-
editTitleClasses: 'text-md sm:text-lg ',
|
|
42
|
-
editTextClasses: 'break-words',
|
|
43
|
-
editInputClasses: 'border border-black text-black bg-white',
|
|
44
|
-
textLineOne: <div><Greeting /><p>Loremipsumdolorsitamet consectetur adipisicing elit</p></div>,
|
|
45
|
-
textLineTwo: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi impedit sed, quis aspernatur voluptate minima vel placeat ipsa amet voluptatem reprehenderit ullam rem cum tempora explicabo veritatis numquam libero asperiores!',
|
|
46
|
-
textLineThree: 'Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tenetur nihil voluptas ipsum labore? Eligendi et ipsam, repellat culpa porro a animi laudantium molestiae provident facere non tempora odit? Perferendis, assumenda.',
|
|
47
|
-
onSave: action('button-save'),
|
|
48
|
-
withLiveUpdates: true,
|
|
49
|
-
isHorizontal: true,
|
|
50
|
-
saveButtonProps: {
|
|
51
|
-
className: 'mt-4',
|
|
52
|
-
children: 'Save'
|
|
53
|
-
},
|
|
54
|
-
cancelButtonProps: {
|
|
55
|
-
className: 'mt-4 ml-4',
|
|
56
|
-
children: 'Cancel'
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const Template: ComponentStory<typeof TextAndTitle> = (args) => <TextAndTitle {...args} />
|
|
62
|
-
|
|
63
|
-
export const _TextAndTitle = Template.bind({})
|
|
64
|
-
|
|
65
|
-
export default componentMeta
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import Input from '@components/Input'
|
|
3
|
-
import Button, { Props as buttonProps } from '@components/Button'
|
|
4
|
-
import classNames from 'classnames'
|
|
5
|
-
import TextArea from '@components/TextArea'
|
|
6
|
-
|
|
7
|
-
export interface Props {
|
|
8
|
-
id: string
|
|
9
|
-
className?: string
|
|
10
|
-
titleClasses?: string
|
|
11
|
-
editTitleClasses?: string
|
|
12
|
-
editTextClasses?: string
|
|
13
|
-
editInputClasses?: string
|
|
14
|
-
textClasses?: string
|
|
15
|
-
textLineOne?: string | object
|
|
16
|
-
textLineTwo?: string | object
|
|
17
|
-
textLineThree?: string | object
|
|
18
|
-
title?: string
|
|
19
|
-
titleBold?: boolean
|
|
20
|
-
textCenter?: boolean
|
|
21
|
-
titleCenter?: boolean
|
|
22
|
-
withLiveUpdates?: boolean
|
|
23
|
-
onSave?: (arr: any[], id: string | undefined) => void
|
|
24
|
-
saveButtonProps?: buttonProps
|
|
25
|
-
cancelButtonProps?: buttonProps
|
|
26
|
-
isHorizontal?: boolean
|
|
27
|
-
children?: any
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const TextAndTitle: React.FC<Props> = ({
|
|
31
|
-
id,
|
|
32
|
-
className,
|
|
33
|
-
titleClasses,
|
|
34
|
-
editTitleClasses,
|
|
35
|
-
editTextClasses,
|
|
36
|
-
editInputClasses,
|
|
37
|
-
textClasses,
|
|
38
|
-
textLineOne,
|
|
39
|
-
textLineTwo,
|
|
40
|
-
textLineThree,
|
|
41
|
-
title,
|
|
42
|
-
titleBold,
|
|
43
|
-
textCenter,
|
|
44
|
-
titleCenter,
|
|
45
|
-
withLiveUpdates = false,
|
|
46
|
-
onSave,
|
|
47
|
-
saveButtonProps,
|
|
48
|
-
cancelButtonProps,
|
|
49
|
-
isHorizontal = true,
|
|
50
|
-
children
|
|
51
|
-
}: Props): JSX.Element => {
|
|
52
|
-
const getLineHeight = (id: string): number => {
|
|
53
|
-
const element = document.getElementById(id)
|
|
54
|
-
const divHeight = element?.offsetHeight !== undefined ? element.offsetHeight : 0
|
|
55
|
-
const lineHeight = (element != null) ? parseFloat(getComputedStyle(element).fontSize) : 1
|
|
56
|
-
const pt = (element != null) ? parseFloat(getComputedStyle(element).paddingTop) : 0
|
|
57
|
-
const pb = (element != null) ? parseFloat(getComputedStyle(element).paddingBottom) : 0
|
|
58
|
-
const mt = (element != null) ? parseFloat(getComputedStyle(element).marginTop) : 0
|
|
59
|
-
const mb = (element != null) ? parseFloat(getComputedStyle(element).marginBottom) : 0
|
|
60
|
-
const bw = (element != null) ? parseFloat(getComputedStyle(element).borderWidth) : 0
|
|
61
|
-
const height = divHeight - mt - mb - pt - pb - (bw * 2)
|
|
62
|
-
|
|
63
|
-
if (isHorizontal) {
|
|
64
|
-
return Math.floor(height / lineHeight) - 1
|
|
65
|
-
}
|
|
66
|
-
return Math.floor(height / lineHeight)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const defaultComponentData = {
|
|
70
|
-
title,
|
|
71
|
-
textLineOne,
|
|
72
|
-
textLineTwo,
|
|
73
|
-
textLineThree
|
|
74
|
-
}
|
|
75
|
-
const [isInEditingMode, setIsInEditingMode] = useState(false)
|
|
76
|
-
const [componentData, setComponentData] = useState(defaultComponentData)
|
|
77
|
-
|
|
78
|
-
const borderClasses = 'border border-transparent'
|
|
79
|
-
const classList = classNames(className, 'bg-primary text-white')
|
|
80
|
-
|
|
81
|
-
const titleClassList = classNames({
|
|
82
|
-
'font-bold': titleBold,
|
|
83
|
-
'text-center': titleCenter,
|
|
84
|
-
[borderClasses]: withLiveUpdates && !isInEditingMode
|
|
85
|
-
}, titleClasses, 'text-md break-words')
|
|
86
|
-
|
|
87
|
-
const textClassList = classNames({
|
|
88
|
-
'text-center': textCenter,
|
|
89
|
-
[borderClasses]: withLiveUpdates && !isInEditingMode
|
|
90
|
-
}, textClasses, 'pt-2 mt-2')
|
|
91
|
-
|
|
92
|
-
const toggleEditState = (): void => {
|
|
93
|
-
withLiveUpdates &&
|
|
94
|
-
setIsInEditingMode(!isInEditingMode)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const handleButtonSave = (): void => {
|
|
98
|
-
const arr = []
|
|
99
|
-
arr.push({ key: 'title', value: componentData.title })
|
|
100
|
-
arr.push({ key: 'textLineOne', value: componentData.textLineOne })
|
|
101
|
-
arr.push({ key: 'textLineTwo', value: componentData.textLineTwo })
|
|
102
|
-
arr.push({ key: 'textLineThree', value: componentData.textLineThree })
|
|
103
|
-
toggleEditState()
|
|
104
|
-
onSave?.(arr, id)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const handleButtonCancel = (): void => {
|
|
108
|
-
return toggleEditState()
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const handleChange = (e: any): void => {
|
|
112
|
-
let id = e.target.id
|
|
113
|
-
id = id.split('-')[id.split('-').length - 1]
|
|
114
|
-
|
|
115
|
-
setComponentData({
|
|
116
|
-
...componentData,
|
|
117
|
-
[id]: e.target.value
|
|
118
|
-
})
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const wrapperClassList = classNames({
|
|
122
|
-
'flex flex-wrap justify-center md:items-center': isHorizontal,
|
|
123
|
-
'hover:border-black hover:border-dashed': withLiveUpdates && !isInEditingMode
|
|
124
|
-
}, 'border-2 border-transparent')
|
|
125
|
-
|
|
126
|
-
const titleWrapperClassList = classNames({
|
|
127
|
-
'md:w-1/2 md:text-center md:px-8': isHorizontal
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
const textWrapperClassList = classNames({
|
|
131
|
-
'md:w-1/2 md:text-center md:py-8 md:px-8': isHorizontal
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
const inputClassList = classNames(editInputClasses, textClassList)
|
|
135
|
-
|
|
136
|
-
const node = document.getElementById('textLineOne')
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<div
|
|
140
|
-
id={id}
|
|
141
|
-
className={classList}
|
|
142
|
-
>
|
|
143
|
-
{withLiveUpdates && isInEditingMode
|
|
144
|
-
? (
|
|
145
|
-
<>
|
|
146
|
-
<div className={wrapperClassList}>
|
|
147
|
-
<div className={titleWrapperClassList}>
|
|
148
|
-
{componentData?.title !== undefined
|
|
149
|
-
? (
|
|
150
|
-
<Input
|
|
151
|
-
className={editTitleClasses}
|
|
152
|
-
inputClasses={inputClassList}
|
|
153
|
-
autoFocus
|
|
154
|
-
value={componentData?.title}
|
|
155
|
-
onChange={(e: any) => handleChange(e)}
|
|
156
|
-
type='text'
|
|
157
|
-
theme='dark'
|
|
158
|
-
/>
|
|
159
|
-
)
|
|
160
|
-
: (
|
|
161
|
-
<div>
|
|
162
|
-
{children}
|
|
163
|
-
</div>
|
|
164
|
-
)}
|
|
165
|
-
</div>
|
|
166
|
-
<div className={textWrapperClassList}>
|
|
167
|
-
<TextArea
|
|
168
|
-
className={editTextClasses}
|
|
169
|
-
textAreaClasses={classNames({
|
|
170
|
-
'text-center': isHorizontal
|
|
171
|
-
}, editInputClasses)}
|
|
172
|
-
rows={getLineHeight('textLineOne') + 1}
|
|
173
|
-
onChange={(e: any) => handleChange(e)}
|
|
174
|
-
theme='dark'
|
|
175
|
-
>
|
|
176
|
-
{node?.innerHTML}
|
|
177
|
-
</TextArea>
|
|
178
|
-
<TextArea
|
|
179
|
-
className={editTextClasses}
|
|
180
|
-
textAreaClasses={classNames({
|
|
181
|
-
'text-center': isHorizontal
|
|
182
|
-
}, editInputClasses)}
|
|
183
|
-
rows={getLineHeight('textLineTwo')}
|
|
184
|
-
onChange={(e: any) => handleChange(e)}
|
|
185
|
-
theme='dark'
|
|
186
|
-
>
|
|
187
|
-
{componentData.textLineTwo}
|
|
188
|
-
</TextArea>
|
|
189
|
-
<TextArea
|
|
190
|
-
className={editTextClasses}
|
|
191
|
-
textAreaClasses={classNames({
|
|
192
|
-
'text-center': isHorizontal
|
|
193
|
-
}, editInputClasses)}
|
|
194
|
-
rows={getLineHeight('textLineThree')}
|
|
195
|
-
onChange={(e: any) => handleChange(e)}
|
|
196
|
-
theme='dark'
|
|
197
|
-
>
|
|
198
|
-
{componentData.textLineThree}
|
|
199
|
-
</TextArea>
|
|
200
|
-
</div>
|
|
201
|
-
</div>
|
|
202
|
-
<Button
|
|
203
|
-
className={saveButtonProps?.className}
|
|
204
|
-
onClick={handleButtonSave}
|
|
205
|
-
>
|
|
206
|
-
{saveButtonProps?.children}
|
|
207
|
-
</Button>
|
|
208
|
-
<Button
|
|
209
|
-
className={cancelButtonProps?.className}
|
|
210
|
-
onClick={handleButtonCancel}
|
|
211
|
-
>
|
|
212
|
-
{cancelButtonProps?.children}
|
|
213
|
-
</Button>
|
|
214
|
-
</>
|
|
215
|
-
)
|
|
216
|
-
: (
|
|
217
|
-
<div
|
|
218
|
-
className={wrapperClassList}
|
|
219
|
-
onClick={toggleEditState}
|
|
220
|
-
>
|
|
221
|
-
<div className={titleWrapperClassList}>
|
|
222
|
-
{componentData?.title !== undefined
|
|
223
|
-
? (
|
|
224
|
-
<h1 className={titleClassList}>
|
|
225
|
-
{componentData.title}
|
|
226
|
-
</h1>
|
|
227
|
-
)
|
|
228
|
-
: (
|
|
229
|
-
children
|
|
230
|
-
)}
|
|
231
|
-
</div>
|
|
232
|
-
<div className={textWrapperClassList}>
|
|
233
|
-
{componentData?.title !== undefined
|
|
234
|
-
? (
|
|
235
|
-
<h1 id='title' className={titleClassList}>
|
|
236
|
-
{componentData.title}
|
|
237
|
-
</h1>
|
|
238
|
-
)
|
|
239
|
-
: (
|
|
240
|
-
<div id='textLineOne' className={textClassList}>
|
|
241
|
-
{componentData.textLineOne}
|
|
242
|
-
</div>
|
|
243
|
-
)}
|
|
244
|
-
<div id='textLineTwo' className={textClassList}>
|
|
245
|
-
{componentData.textLineTwo}
|
|
246
|
-
</div>
|
|
247
|
-
<div id='textLineThree' className={textClassList}>
|
|
248
|
-
{componentData.textLineThree}
|
|
249
|
-
</div>
|
|
250
|
-
</div>
|
|
251
|
-
</div>
|
|
252
|
-
)}
|
|
253
|
-
</div>
|
|
254
|
-
)
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export default TextAndTitle
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import TextArea from './index'
|
|
3
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
|
4
|
-
|
|
5
|
-
const componentMeta: ComponentMeta<typeof TextArea> = {
|
|
6
|
-
title: 'Trepur Components/Rupert Bennett/Atoms/Text Area',
|
|
7
|
-
component: TextArea,
|
|
8
|
-
parameters: {},
|
|
9
|
-
argTypes: {
|
|
10
|
-
id: {
|
|
11
|
-
description: 'Defines the id of the component',
|
|
12
|
-
table: {
|
|
13
|
-
category: '',
|
|
14
|
-
type: { summary: 'string' },
|
|
15
|
-
defaultValue: { summary: 'undefined' }
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
className: {
|
|
19
|
-
description: 'Defines any additional classes for the components',
|
|
20
|
-
table: {
|
|
21
|
-
category: '',
|
|
22
|
-
type: { summary: 'string' },
|
|
23
|
-
defaultValue: { summary: 'undefined' }
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
label: {
|
|
27
|
-
description: '',
|
|
28
|
-
control: 'text',
|
|
29
|
-
table: {
|
|
30
|
-
category: ''
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
placeholder: {
|
|
34
|
-
description: '',
|
|
35
|
-
control: 'text',
|
|
36
|
-
table: {
|
|
37
|
-
category: ''
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
bold: {
|
|
41
|
-
description: '',
|
|
42
|
-
control: 'boolean',
|
|
43
|
-
table: {
|
|
44
|
-
category: ''
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
theme: {
|
|
48
|
-
type: { name: 'string', required: false },
|
|
49
|
-
options: ['dark', 'light'],
|
|
50
|
-
description: 'The variant of button to render',
|
|
51
|
-
table: { type: { summary: 'dark' }, defaultValue: { summary: 'dark' } },
|
|
52
|
-
defaultValue: 'dark',
|
|
53
|
-
control: { type: 'radio' }
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
args: {
|
|
57
|
-
label: 'This is a label',
|
|
58
|
-
placeholder: 'This is a text area placeholder',
|
|
59
|
-
withPadding: true
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const Template: ComponentStory<typeof TextArea> = (args) => <TextArea {...args} />
|
|
64
|
-
|
|
65
|
-
export const _TextArea = Template.bind({})
|
|
66
|
-
|
|
67
|
-
export default componentMeta
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import classNames from 'classnames'
|
|
3
|
-
|
|
4
|
-
export interface Props {
|
|
5
|
-
id?: string
|
|
6
|
-
className?: string
|
|
7
|
-
labelClasses?: string
|
|
8
|
-
textAreaClasses?: string
|
|
9
|
-
label?: string
|
|
10
|
-
placeholder?: string
|
|
11
|
-
bold?: boolean
|
|
12
|
-
name?: string
|
|
13
|
-
disabled?: boolean
|
|
14
|
-
rows?: number
|
|
15
|
-
cols?: number
|
|
16
|
-
autoFocus?: boolean
|
|
17
|
-
formId?: string
|
|
18
|
-
maxLength?: number
|
|
19
|
-
readOnly?: boolean
|
|
20
|
-
required?: boolean
|
|
21
|
-
onBlur?: () => void
|
|
22
|
-
onFocus?: () => void
|
|
23
|
-
onChange?: (e: any) => void
|
|
24
|
-
withPadding?: boolean
|
|
25
|
-
children?: any
|
|
26
|
-
theme?: 'dark' | 'light'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const TextArea = ({
|
|
30
|
-
id,
|
|
31
|
-
className,
|
|
32
|
-
labelClasses,
|
|
33
|
-
textAreaClasses,
|
|
34
|
-
label,
|
|
35
|
-
placeholder,
|
|
36
|
-
bold,
|
|
37
|
-
name,
|
|
38
|
-
disabled,
|
|
39
|
-
rows,
|
|
40
|
-
cols,
|
|
41
|
-
autoFocus,
|
|
42
|
-
formId,
|
|
43
|
-
maxLength,
|
|
44
|
-
readOnly,
|
|
45
|
-
required,
|
|
46
|
-
onBlur,
|
|
47
|
-
onFocus,
|
|
48
|
-
onChange,
|
|
49
|
-
withPadding,
|
|
50
|
-
children,
|
|
51
|
-
theme = 'light'
|
|
52
|
-
}: Props): JSX.Element => {
|
|
53
|
-
const colours = theme === 'dark' ? 'placeholder-white bg-primary text-white' : 'placeholder-primary bg-white text-primary'
|
|
54
|
-
const classList = classNames(className, colours, 'flex flex-col')
|
|
55
|
-
const newId = id !== undefined ? `-${id}` : '-'
|
|
56
|
-
const labelClassList = classNames({
|
|
57
|
-
'font-bold': bold
|
|
58
|
-
}, labelClasses, 'w-auto pb-2')
|
|
59
|
-
|
|
60
|
-
const textAreaClassList = classNames({
|
|
61
|
-
'p-2': withPadding
|
|
62
|
-
}, textAreaClasses, colours, 'border rounded-md mb-2')
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<div
|
|
66
|
-
id={id}
|
|
67
|
-
className={classList}
|
|
68
|
-
>
|
|
69
|
-
{label !== undefined &&
|
|
70
|
-
<label
|
|
71
|
-
className={labelClassList}
|
|
72
|
-
htmlFor={`text-area${newId}`}
|
|
73
|
-
>
|
|
74
|
-
{label}
|
|
75
|
-
</label>}
|
|
76
|
-
<textarea
|
|
77
|
-
className={textAreaClassList}
|
|
78
|
-
autoFocus={autoFocus}
|
|
79
|
-
form={formId}
|
|
80
|
-
maxLength={maxLength}
|
|
81
|
-
readOnly={readOnly}
|
|
82
|
-
required={required}
|
|
83
|
-
disabled={disabled}
|
|
84
|
-
rows={rows}
|
|
85
|
-
cols={cols}
|
|
86
|
-
name={name}
|
|
87
|
-
placeholder={placeholder}
|
|
88
|
-
onChange={onChange}
|
|
89
|
-
onFocus={onFocus}
|
|
90
|
-
onBlur={onBlur}
|
|
91
|
-
defaultValue={children}
|
|
92
|
-
/>
|
|
93
|
-
</div>
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export default TextArea
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import Timeline from './index'
|
|
3
|
-
import CardWithTopImage from '@components/CardWithTopImage'
|
|
4
|
-
import { ComponentStory, ComponentMeta } from '@storybook/react'
|
|
5
|
-
import logo from '@assets/images/primary-logo.png'
|
|
6
|
-
import { Props as imageProps } from '@components/Image'
|
|
7
|
-
|
|
8
|
-
const timelineItems = (): Array<{ component: JSX.Element, centerImageProps: imageProps }> => {
|
|
9
|
-
return new Array(8).fill(null).map(() => {
|
|
10
|
-
return (
|
|
11
|
-
{
|
|
12
|
-
component:
|
|
13
|
-
<CardWithTopImage
|
|
14
|
-
imageProps={{
|
|
15
|
-
image: logo,
|
|
16
|
-
roundedFull: true,
|
|
17
|
-
width: 4,
|
|
18
|
-
height: 4
|
|
19
|
-
}}
|
|
20
|
-
className='px-4'
|
|
21
|
-
>
|
|
22
|
-
<p>This is some text</p>
|
|
23
|
-
<p>This is some more text</p>
|
|
24
|
-
<p>This is a bit more text</p>
|
|
25
|
-
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem odit ad sed, quam recusandae voluptatem provident eveniet beatae omnis vero minus unde facilis. Quia commodi quas odit iusto ut enim!</p>
|
|
26
|
-
</CardWithTopImage>,
|
|
27
|
-
centerImageProps: {
|
|
28
|
-
image: logo,
|
|
29
|
-
imageClasses: 'mx-auto',
|
|
30
|
-
width: 4,
|
|
31
|
-
height: 4,
|
|
32
|
-
centerAligned: true,
|
|
33
|
-
roundedFull: true
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
)
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const componentMeta: ComponentMeta<typeof Timeline> = {
|
|
41
|
-
title: 'Trepur Components/Rupert Bennett/Organisms/Timeline',
|
|
42
|
-
component: Timeline,
|
|
43
|
-
parameters: {},
|
|
44
|
-
argTypes: {
|
|
45
|
-
id: {
|
|
46
|
-
description: 'Defines the id of the component',
|
|
47
|
-
control: { type: 'text', default: false },
|
|
48
|
-
table: {
|
|
49
|
-
category: 'Id',
|
|
50
|
-
type: { summary: 'string' },
|
|
51
|
-
defaultValue: { summary: 'undefined' }
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
className: {
|
|
55
|
-
description: 'Defines any additional classes for the components',
|
|
56
|
-
control: { type: 'text', default: false },
|
|
57
|
-
table: {
|
|
58
|
-
category: 'Classes',
|
|
59
|
-
type: { summary: 'string' },
|
|
60
|
-
defaultValue: { summary: 'undefined' }
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
isHorizontal: {
|
|
64
|
-
description: '',
|
|
65
|
-
control: 'boolean',
|
|
66
|
-
table: {
|
|
67
|
-
category: ''
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
useImages: {
|
|
71
|
-
description: '',
|
|
72
|
-
control: 'boolean',
|
|
73
|
-
table: {
|
|
74
|
-
category: ''
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
items: {
|
|
78
|
-
description: '',
|
|
79
|
-
control: 'array',
|
|
80
|
-
table: {
|
|
81
|
-
category: ''
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
args: {
|
|
86
|
-
isHorizontal: true,
|
|
87
|
-
reverse: false,
|
|
88
|
-
items: timelineItems(),
|
|
89
|
-
textCenter: true,
|
|
90
|
-
useImages: true,
|
|
91
|
-
horizontalComponentClasses: 'w-96 h-96',
|
|
92
|
-
isSm: true
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const Template: ComponentStory<typeof Timeline> = (args) => <Timeline {...args} />
|
|
97
|
-
|
|
98
|
-
export const _Timeline = Template.bind({})
|
|
99
|
-
|
|
100
|
-
export default componentMeta
|