cloud-business 0.1.102 → 0.1.103

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.
@@ -1,204 +0,0 @@
1
- @border-color: #e4eefd;
2
-
3
- .code-box {
4
- position: relative;
5
- width: 100%;
6
- margin: 0 0 30px;
7
- border: 1px solid @border-color;
8
- border-radius: 3px;
9
- transition: .3s;
10
- overflow: hidden;
11
-
12
- &:hover {
13
- box-shadow: 0 0 5px #ddd;
14
- }
15
-
16
- &-demo {
17
- padding: 20px;
18
- color: rgba(0,0,0,0.65);
19
- border-bottom: 1px solid @border-color;
20
- }
21
-
22
- &-title {
23
- position: relative;
24
- padding: 10px 20px;
25
- margin: 0 !important;
26
- background: rgba(139, 200, 255, 0.1);
27
- border-bottom: 1px solid #f5f5f5;
28
- color: #333 !important;
29
- font-weight: 500 !important;
30
- }
31
-
32
- &-desc {
33
- margin-left: 5px;
34
- font-size: 12px;
35
- font-weight: 400;
36
- color: #888;
37
- }
38
-
39
- &-actions {
40
- display: flex;
41
- justify-content: center;
42
- align-items: center;
43
- padding: 10px 0;
44
- transition: .3s;
45
- letter-spacing: 2px;
46
- background: rgba(139, 200, 255, 0.05);
47
- color: #52a6fa;
48
- cursor: pointer;
49
-
50
- &.expand .icon {
51
- opacity: 1;
52
- }
53
- }
54
-
55
- .icon {
56
- margin: 0 12px;
57
- display: flex;
58
- align-items: center;
59
- opacity: .4;
60
- transition: .2s;
61
- cursor: pointer;
62
- user-select: none;
63
-
64
- img {
65
- margin-right: 4px;
66
- vertical-align: top;
67
- width: 16px;
68
- height: auto;
69
- cursor: pointer;
70
- }
71
-
72
- &-desc {
73
- white-space: nowrap;
74
- overflow: hidden;
75
- font-weight: 300;
76
- }
77
- }
78
-
79
- &:hover &-actions {
80
- .icon {
81
- opacity: 1;
82
- }
83
- }
84
-
85
- > *:last-child {
86
- border-bottom: none;
87
- }
88
-
89
- .hidden {
90
- display: none;
91
- }
92
-
93
- .code-block {
94
- margin-top: 0;
95
- margin-bottom: 0;
96
- padding: 15px;
97
- padding-bottom: 25px;
98
- line-height: 1.42;
99
- color: #405d79;
100
- background: #fbfbfb;
101
- border-top: 1px solid @border-color;
102
- overflow-y: auto;
103
- }
104
- }
105
-
106
- :global {
107
- .hljs {
108
- display: block;
109
- overflow-x: auto;
110
- padding: 0.5em;
111
- color: #333;
112
- background: #f8f8f8;
113
- }
114
-
115
- .hljs-comment,
116
- .hljs-quote {
117
- color: #998;
118
- font-style: italic;
119
- }
120
-
121
- .hljs-keyword,
122
- .hljs-selector-tag,
123
- .hljs-subst {
124
- color:#118ddd;
125
- font-weight: bold;
126
- }
127
-
128
- .hljs-number,
129
- .hljs-literal,
130
- .hljs-variable,
131
- .hljs-template-variable,
132
- .hljs-tag .hljs-attr {
133
- color: #008080;
134
- }
135
-
136
- .hljs-string,
137
- .hljs-doctag {
138
- color: #03a6ab;
139
- }
140
-
141
- .hljs-title,
142
- .hljs-section,
143
- .hljs-selector-id {
144
- color: #900;
145
- font-weight: bold;
146
- }
147
-
148
- .hljs-subst {
149
- font-weight: normal;
150
- }
151
-
152
- .hljs-type,
153
- .hljs-class .hljs-title {
154
- color: #049ac1;
155
- font-weight: bold;
156
- }
157
-
158
- .hljs-tag,
159
- .hljs-name,
160
- .hljs-attribute {
161
- color: #000080;
162
- font-weight: normal;
163
- }
164
-
165
- .hljs-regexp,
166
- .hljs-link {
167
- color: #009926;
168
- }
169
-
170
- .hljs-symbol,
171
- .hljs-bullet {
172
- color: #990073;
173
- }
174
-
175
- .hljs-built_in,
176
- .hljs-builtin-name {
177
- color: #0086b3;
178
- }
179
-
180
- .hljs-meta {
181
- color: #999;
182
- font-weight: bold;
183
- }
184
-
185
- .hljs-deletion {
186
- background: #fdd;
187
- }
188
-
189
- .hljs-addition {
190
- background: #dfd;
191
- }
192
-
193
- .hljs-emphasis {
194
- font-style: italic;
195
- }
196
-
197
- .hljs-strong {
198
- font-weight: bold;
199
- }
200
-
201
- .hljs-params {
202
-
203
- }
204
- }
@@ -1,105 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
- import PropTypes from 'prop-types';
4
- import CodeBox from '../code-box';
5
- import classes from './index.less';
6
-
7
- const createElement = (className = '__empty__') => {
8
- const element = document.createElement('div');
9
- element.classList.add(className);
10
- return element;
11
- }
12
-
13
- const separateMarkdownHtml = html => {
14
- const container = createElement();
15
- const tmpWrap = createElement();
16
- tmpWrap.innerHTML = html;
17
-
18
- let markdownBody = createElement(classes.markdownBody);
19
-
20
- [...tmpWrap.children].forEach(element => {
21
- if (!element.id || element.id !== 'code-demo') {
22
- markdownBody.appendChild(element);
23
- } else {
24
- // append markdownBody
25
- container.appendChild(markdownBody);
26
-
27
- // append code-demo Element
28
- container.appendChild(element);
29
-
30
- // create a new markdownBody
31
- markdownBody = createElement(classes.markdownBody);
32
- }
33
- });
34
-
35
- container.appendChild(markdownBody);
36
-
37
- return container.innerHTML;
38
- }
39
-
40
- export default class MarkdownOutput extends React.Component {
41
- static propTypes = {
42
- demos: PropTypes.any,
43
- title: PropTypes.string,
44
- html: PropTypes.string,
45
- subtitle: PropTypes.string
46
- };
47
-
48
- static defaultProps = {
49
- demos: [],
50
- title: '',
51
- html: '',
52
- subtitle: ''
53
- };
54
-
55
- constructor(props) {
56
- super(props);
57
- this.markdownRef = React.createRef();
58
- this.wrapers = [];
59
- }
60
-
61
- componentDidMount() {
62
- const { demos } = this.props;
63
- this.markdownBody.parentNode.scrollTop = 0;
64
-
65
- demos
66
- .sort((p, n) => p.order - n.order)
67
- .filter(v => v).forEach(Demo => {
68
- const wrap = document.createElement('div');
69
-
70
- ReactDOM.render(
71
- <CodeBox title={Demo.title} desc={Demo.desc} code={Demo.code} css={Demo.css}>
72
- <Demo />
73
- </CodeBox>,
74
- wrap
75
- );
76
-
77
- this.wrapers.push(wrap);
78
-
79
- this.codeWrap.appendChild(wrap);
80
- });
81
- }
82
-
83
- componentWillUnmount() {
84
- this.wrapers.forEach(ReactDOM.unmountComponentAtNode);
85
- }
86
-
87
- get markdownBody() {
88
- return this.markdownRef.current;
89
- }
90
-
91
- get codeWrap() {
92
- return this.markdownBody.querySelector('#code-demo');
93
- }
94
-
95
- render() {
96
- const { title, html, subtitle } = this.props;
97
-
98
- return (
99
- <section ref={this.markdownRef}>
100
- <h1 className={classes.title}>{title} {subtitle}</h1>
101
- <div dangerouslySetInnerHTML={{ __html: separateMarkdownHtml(html) }} />
102
- </section>
103
- );
104
- }
105
- }