aboutsummaryrefslogtreecommitdiffstats
path: root/stories/ng2-component-lab/tooltip.directive.exp.ts
blob: 9e1dd0b270d51052ad48a45efda26493e9f5c47a (plain)
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
import { experimentOn } from '@islavi/ng2-component-lab';
import { ArrowPlacement, TooltipPlacement } from '../../src/angular/tooltip/tooltip.directive';

const customTemplate = `
    .sdc-custom-tooltip-template-title {
        font-size: 20px;
        font-weight: bold;
        background-color: $black;
        color: $white;
        text-align: center;
    }

    .sdc-custom-tooltip-template-content {
        background-color: $black;
        color: $white;
        display: inline-block;
        text-align: center;
    }

    .sdc-custom-tooltip-template-image {
        width: 100%;
        height:100%;
        display: inline-block;
        text-align: center;
        background-color: #ffffff;
    }
`;

export default experimentOn('Tooltip')
    .group("Tooltip",[
        {
            id: 'leftAlignmentTextTooltip',
            showSource: true,
            title: 'Tooltip with short text (left placement)',
            description: 'left placement',
            context: {
                placement: TooltipPlacement.Left,
                arrowPlacement: ArrowPlacement.LeftTop
            },
            template: `
                <div style="padding-bottom: 20px; width: 350px;">Lorem ipsum dolor sit amet,
                    <span  style="color: #009fdb"
                        sdc-tooltip
                            tooltip-text = 'A short text name, short text'
                            [tooltip-placement]= 'placement'
                            [tooltip-arrow-placement] = 'arrowPlacement'>show tooltip
                    </span>
                    ,consectetur adipiscing elit. Sed risus nisl, egestas vitae erat non, pulvinar lacinia libero.
                    Integer pulvinar pellentesque accumsan.
                    <span  style="color: #009fdb"
                        sdc-tooltip
                            tooltip-text = 'A short text name, short text'
                            [tooltip-placement]= 'placement'
                            [tooltip-arrow-placement] = 'arrowPlacement'>show tooltip
                    </span>
                    Sed hendrerit lacus eu tempus pharetra
                </div>
                `
        },
        {
            id: 'leftAlignmentMultiLineTextTooltip',
            showSource: true,
            title: 'Tooltip with multi line text (left placement)',
            description: 'left placement',
            context: {
                placement: TooltipPlacement.Left,
                arrowPlacement: ArrowPlacement.LeftTop
            },
            template: `
                <div style="padding-bottom: 20px;">
                    The is text example,
                    <span  style="color: #009fdb"
                        sdc-tooltip
                            tooltip-text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed risus nisl, egestas vitae erat non, pulvinar lacinia libero. Integer pulvinar pellentesque accumsan. Sed hendrerit lacus eu tempus pharetra'
                            [tooltip-placement]= 'placement'
                            [tooltip-arrow-placement] = 'arrowPlacement'>show tooltip
                    </span>
                    , more text
                </div>
                `
        },
        {
            id: 'customStyleTooltip',
            showSource: true,
            title: 'Tooltip with custom style',
            description: 'Tooltip with custom style, define your class and style it via css.',
            context: {
                text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed risus nisl, egestas vitae erat non, pulvinar lacinia libero. Integer pulvinar pellentesque accumsan. Sed hendrerit lacus eu tempus pharetra'
            },
            template: `
                <![CDATA[
                    .sdc-custom-tooltip {
                        background-color: $dark-blue;
                        border-color: $dark-blue;
                        border-radius: 10px;
                    }
                ]]>
                <div style="padding-bottom: 20px;">
                    Some text example,
                    <span style="color: #009fdb" sdc-tooltip [tooltip-text]=text tooltip-css-class='sdc-custom-tooltip'>show tooltip</span>, more text
                </div>
                `
        },
        {
            id: 'rightAlignmentHtmlTooltip',
            showSource: true,
            title: 'Tooltip with HTML template (right placement)',
            description: 'right placement',
            context: {
                placement: TooltipPlacement.Right,
                arrowPlacement: ArrowPlacement.LeftTop
            },
            styles: [customTemplate],
            template: `
                Template Input:
                <pre><![CDATA[
                    <img src="../../../assets/images/logo_onap.png" class="sdc-custom-tooltip-template-image" />
                    <p class="sdc-tooltip-template-content">A long text name, very long, long text ...</p>
                ]]></pre>

                <div style="padding-bottom: 20px;">
                    The is text example,
                    <span  style="color: #009fdb"
                        sdc-tooltip
                            tooltip-text = 'This is the tooltip test'
                            [tooltip-placement]= 'placement'
                            [tooltip-arrow-placement] = 'arrowPlacement'
                            [tooltip-template]='template'>show tooltip
                    </span>
                    , more text
                </div>

                <template #template>
                    <img src="../../../assets/images/logo_onap.png" class="sdc-custom-tooltip-template-image" />
                    <p class="sdc-tooltip-template-content">A long text name, very long, long text ...</p>
                </template>
                `
        },
        {
            id: 'rightAlignmentHtmlCustomStyleTooltip',
            showSource: true,
            title: 'Tooltip with HTML template and custom style (right placement)',
            description: 'right placement',
            context: {
                placement: TooltipPlacement.Right,
                arrowPlacement: ArrowPlacement.LeftTop
            },
            styles: [customTemplate],
            template: `
                Template Input:
                <pre><![CDATA[
                    <p class="sdc-custom-tooltip-template-title sdc-tooltip-template-big-title">Title... Title... Title... Title... Title...</p>
                    <img src="../../../assets/images/logo_onap.png" class="sdc-custom-tooltip-template-image" />
                    <p class="sdc-custom-tooltip-template-content">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed risus nisl, egestas vitae erat non, pulvinar lacinia libero. Integer pulvinar pellentesque accumsan. Sed hendrerit lacus eu tempus pharetra</p>
                ]]></pre>

                <div style="padding-bottom: 20px;">
                    The is text example,
                    <span  style="color: #009fdb"
                        sdc-tooltip
                            tooltip-text = 'This is the tooltip test'
                            [tooltip-placement]= 'placement'
                            tooltip-css-class = 'sdc-custom-tooltip'
                            [tooltip-arrow-placement] = 'arrowPlacement'
                            [tooltip-template]='template'>show tooltip
                    </span>
                    , more text
                </div>

                <template #template>
                    <p class="sdc-custom-tooltip-template-title sdc-tooltip-template-big-title">Title... Title... Title... Title... Title...</p>
                    <img src="../../../assets/images/logo_onap.png" class="sdc-custom-tooltip-template-image" />
                    <p class="sdc-custom-tooltip-template-content">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed risus nisl, egestas vitae erat non, pulvinar lacinia libero. Integer pulvinar pellentesque accumsan. Sed hendrerit lacus eu tempus pharetra</p>
                </template>
                `
        },
        {
            id: 'topAlignmentTextTooltip',
            showSource: true,
            title: 'Tooltip with text (top placement)',
            description: 'top placement',
            context: {
                placement: TooltipPlacement.Top,
                arrowPlacement: ArrowPlacement.LeftTop
            },
            template: `
                <div style="padding-bottom: 20px;">
                    The is text example,
                    <span  style="color: #009fdb"
                        sdc-tooltip
                            tooltip-text = 'A long text name, very long, long text'
                            [tooltip-placement]= 'placement'
                            [tooltip-arrow-placement] = 'arrowPlacement'>show tooltip
                    </span>
                    , more text
                </div>
                `
        },
        {
            id: 'bottomAlignmentHtmlTooltip',
            showSource: true,
            title: 'Tooltip with HTML template (bottom placement)',
            description: 'bottom placement',
            context: {
                placement: TooltipPlacement.Bottom,
                arrowPlacement: ArrowPlacement.LeftTop
            },
            template: `
                Template Input:
                <pre><![CDATA[
                    <div class="sdc-tooltip-template-content">A long text name,</div>
                    <div class="sdc-tooltip-template-content">very long, long text</div>
                ]]></pre>

                <div style="width:30%; height: 30px; text-align: center;">
                    The is text example,
                    <a style="color: #009fdb; font-size: small; cursor: pointer;"
                        sdc-tooltip
                            tooltip-text = 'This is the tooltip test'
                            [tooltip-placement]= 'placement'
                            [tooltip-arrow-placement] = 'arrowPlacement'
                            [tooltip-template]='template' >link example</a>
                    , more text
                </div>
                <template #template>
                    <div class="sdc-tooltip-template-content">A long text name,</div>
                    <div class="sdc-tooltip-template-content">very long, long text</div>
                </template>
                `
        },
    ]);