-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWellMap.stories.tsx
More file actions
142 lines (127 loc) · 3.95 KB
/
WellMap.stories.tsx
File metadata and controls
142 lines (127 loc) · 3.95 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import type { Decorator, Meta, StoryObj } from '@storybook/react'
import { scaleOrdinal } from 'd3-scale'
import { ComponentProps, CSSProperties, useState } from 'react'
import { DataProviderDecorator } from '../../../storybook/decorators/data-provider-decorator'
import storyArgs from '../../../storybook/story-args.json'
import { WellMapCasingShoes } from './addons/WellMapCasingShoes'
import { WellMapCompletionIntervals } from './addons/WellMapCompletionIntervals'
import { WellMapFormations } from './addons/WellMapFormations'
import { WellMapTvd } from './addons/WellMapTvd'
import { LightTheme } from './themes'
import { WellMap } from './WellMap'
const commonStyles: CSSProperties = {
padding: '10px',
boxSizing: 'border-box',
minHeight: '1000px',
height: '100%',
width: '100%',
maxWidth: '600px',
display: 'inline-flex',
flexDirection: 'column',
flexWrap: 'wrap',
color: 'white',
}
const darkThemeDecorator: Decorator = (Story: any, { args }: any) => {
const [depth, setDepth] = useState<number>(1)
const [selected, setSelected] = useState<string | undefined>()
return (
<div style={{
...commonStyles,
background: '#333',
}}>
<Story args={{ ...args, depth, onDepthChanged: setDepth, selected, onSelect: setSelected }} />
</div>
)
}
const lightThemeDecorator: Decorator = (Story: any, { args }: any) => {
const [depth, setDepth] = useState<number>(1)
const [selected, setSelected] = useState<string | undefined>()
return (
<div style={{
...commonStyles,
background: '#fff',
}}>
<Story args={{ ...args, depth, onDepthChanged: setDepth, selected, onSelect: setSelected }} />
</div>
)
}
const meta = {
title: 'Components/Html/WellMap',
component: WellMap,
args: {
wellIdentifier: storyArgs.defaultWell,
},
tags: ['autodocs'],
decorators: [
DataProviderDecorator,
]
} satisfies Meta<typeof WellMap>
export default meta
type Story = StoryObj<typeof meta>
const colorScale = scaleOrdinal(["#4e79a7", "#f28e2c", "#76b7b2", "#59a14f", "#edc949", "#af7aa1", "#ff9da7", "#9c755f", "#bab0ab", "darkgreen", "purple", "#24ca85"])
export const Default: Story = {
decorators: [darkThemeDecorator],
render: (args: ComponentProps<typeof WellMap>) => {
return (
<WellMap {...args} colors={w => colorScale(w.id)} />
)
}
}
export const WithCasingAndCompletionIntervals: Story = {
decorators: [darkThemeDecorator],
render: (args: ComponentProps<typeof WellMap>) => {
return (
<WellMap {...args} colors={w => colorScale(w.id)}>
<WellMapCompletionIntervals />
<WellMapCasingShoes />
</WellMap>
)
}
}
export const WithFormationsAndTvdDepths: Story = {
decorators: [darkThemeDecorator],
render: (args: ComponentProps<typeof WellMap>) => {
return (
<WellMap {...args} colors={w => colorScale(w.id)}>
<WellMapFormations stratColumnId={storyArgs.defaultStratColumn} />
<WellMapTvd />
</WellMap>
)
}
}
export const NonInteractive: Story = {
decorators: [darkThemeDecorator],
render: (args: ComponentProps<typeof WellMap>) => {
return (
<WellMap {...args} colors={w => colorScale(w.id)} interactive={false}>
<WellMapCompletionIntervals />
<WellMapCasingShoes />
</WellMap>
)
}
}
export const Headless: Story = {
decorators: [darkThemeDecorator],
render: (args: ComponentProps<typeof WellMap>) => {
return (
<WellMap {...args} colors={w => colorScale(w.id)} headless depthCursor={false}>
<WellMapCompletionIntervals />
<WellMapCasingShoes />
</WellMap>
)
}
}
export const LightThemed: Story = {
args: {
theme: LightTheme
},
decorators: [lightThemeDecorator],
render: (args: ComponentProps<typeof WellMap>) => {
return (
<WellMap {...args} colors={w => colorScale(w.id)}>
<WellMapFormations stratColumnId={storyArgs.defaultStratColumn} />
<WellMapCasingShoes color="black" />
</WellMap>
)
}
}