瀏覽代碼

ref(dial-out): use AtlasKit FieldText for inputs

- Swap the telephone input with FieldText.
- Swap the dropdown trigger input with FieldText for styling
  consistency with the telephone input.
- Wrap the dropdown trigger so it can be modified with jitsi css.
- Use flexbox to have the trigger and input align horizontally
  but have the input take up width if the trigger is not displayed.
j8
Leonard Kim 8 年之前
父節點
當前提交
3e84d8b3b6
共有 2 個文件被更改,包括 50 次插入23 次删除
  1. 27
    10
      css/_dial-out.scss
  2. 23
    13
      react/features/dial-out/components/DialOutNumbersForm.web.js

+ 27
- 10
css/_dial-out.scss 查看文件

4
 .dial-out-content {
4
 .dial-out-content {
5
     margin-top: 5px;
5
     margin-top: 5px;
6
 
6
 
7
+    /**
8
+     * Wrap the contents in flex so items can be aligned on the same line.
9
+     */
10
+    .form-control {
11
+        display: flex;
12
+    }
13
+
7
    /**
14
    /**
8
     * The style of the flag icon.
15
     * The style of the flag icon.
9
     */
16
     */
10
     .dial-out-flag-icon {
17
     .dial-out-flag-icon {
11
         position: absolute;
18
         position: absolute;
12
         left: 5px;
19
         left: 5px;
13
-        top: 10px;
20
+        top: 50%;
21
+        transform: translate(0, -50%);
14
     }
22
     }
15
 
23
 
16
     /**
24
     /**
17
      * The style of the dial code element.
25
      * The style of the dial code element.
18
      */
26
      */
19
     .dial-out-code {
27
     .dial-out-code {
20
-        padding-left: 25px !important;
28
+        margin-bottom: 0;
29
+        padding-left: 25px;
21
     }
30
     }
22
 
31
 
23
     /**
32
     /**
31
      * The style of the dial input element.
40
      * The style of the dial input element.
32
      */
41
      */
33
     .dial-out-input {
42
     .dial-out-input {
34
-        padding-left: 70px;
43
+        display: inline-block;
44
+        flex: 1;
45
+        margin-left: 5px;
35
     }
46
     }
36
 
47
 
37
     /**
48
     /**
38
      * Re-styling the default dropdown inside the dial-out-content.
49
      * Re-styling the default dropdown inside the dial-out-content.
39
      */
50
      */
40
     .dropdown {
51
     .dropdown {
41
-        left: $formPadding;
42
-        position: absolute !important;
43
-        width: 65px
52
+        position: relative;
53
+        width: 65px;
44
     }
54
     }
45
 
55
 
46
     /**
56
     /**
47
      * Re-styling the default form-control inside the dial-out-content.
57
      * Re-styling the default form-control inside the dial-out-content.
48
      */
58
      */
49
     .form-control {
59
     .form-control {
50
-        padding-bottom: 8px !important;
60
+        margin-bottom: 8px;
51
     }
61
     }
52
 
62
 
53
     .dropdown {
63
     .dropdown {
54
-        display: inline-block;
55
         position: relative;
64
         position: relative;
56
-        overflow: hidden;
65
+
66
+        input {
67
+            padding-left: 16px;
68
+
69
+            &:read-only {
70
+                color: inherit;
71
+            }
72
+        }
57
     }
73
     }
58
 
74
 
59
     .dropdown-trigger-icon {
75
     .dropdown-trigger-icon {
60
         position: absolute;
76
         position: absolute;
61
         right: 0;
77
         right: 0;
62
-        top: 4px;
78
+        top: 50%;
79
+        transform: translate(0, -50%);
63
     }
80
     }
64
 }
81
 }

+ 23
- 13
react/features/dial-out/components/DialOutNumbersForm.web.js 查看文件

1
 import { StatelessDropdownMenu } from '@atlaskit/dropdown-menu';
1
 import { StatelessDropdownMenu } from '@atlaskit/dropdown-menu';
2
+import AKFieldText, { FieldText } from '@atlaskit/field-text';
2
 import ExpandIcon from '@atlaskit/icon/glyph/expand';
3
 import ExpandIcon from '@atlaskit/icon/glyph/expand';
3
 import React, { Component } from 'react';
4
 import React, { Component } from 'react';
4
 import { connect } from 'react-redux';
5
 import { connect } from 'react-redux';
146
             <div className = 'form-control'>
147
             <div className = 'form-control'>
147
                 { this._createDropdownMenu(items) }
148
                 { this._createDropdownMenu(items) }
148
                 <div className = 'dial-out-input'>
149
                 <div className = 'dial-out-input'>
149
-                    <input
150
+                    <AKFieldText
150
                         autoFocus = { true }
151
                         autoFocus = { true }
151
-                        className = 'input-control'
152
+                        isLabelHidden = { true }
153
+                        label = { 'dial-out-input-field' }
152
                         onChange = { this._onInputChange }
154
                         onChange = { this._onInputChange }
153
                         placeholder = { t('dialOut.enterPhone') }
155
                         placeholder = { t('dialOut.enterPhone') }
154
                         ref = { this._setDialInputElement }
156
                         ref = { this._setDialInputElement }
155
-                        type = 'text' />
157
+                        shouldFitContainer = { true } />
156
                 </div>
158
                 </div>
157
             </div>
159
             </div>
158
         );
160
         );
168
         const { code, dialCode } = this.state.selectedCountry;
170
         const { code, dialCode } = this.state.selectedCountry;
169
 
171
 
170
         return (
172
         return (
171
-            <StatelessDropdownMenu
172
-                isOpen = { this.state.isDropdownOpen }
173
-                items = { [ { items } ] }
174
-                onItemActivated = { this._onSelect }
175
-                onOpenChange = { this._onOpenChange }
176
-                shouldFitContainer = { true }>
177
-                { this._createDropdownTrigger(dialCode, code) }
178
-            </StatelessDropdownMenu>
173
+            <div className = 'dropdown-container'>
174
+                <StatelessDropdownMenu
175
+                    isOpen = { this.state.isDropdownOpen }
176
+                    items = { [ { items } ] }
177
+                    onItemActivated = { this._onSelect }
178
+                    onOpenChange = { this._onOpenChange }
179
+                    shouldFitContainer = { false }>
180
+                    { this._createDropdownTrigger(dialCode, code) }
181
+                </StatelessDropdownMenu>
182
+            </div>
179
         );
183
         );
180
     }
184
     }
181
 
185
 
195
                 <CountryIcon
199
                 <CountryIcon
196
                     className = 'dial-out-flag-icon'
200
                     className = 'dial-out-flag-icon'
197
                     countryCode = { `${countryCode}` } />
201
                     countryCode = { `${countryCode}` } />
198
-                <input
202
+                { /**
203
+                   * FIXME Replace FieldText with AtlasKit Button when an issue
204
+                   * with icons shrinking due to button text is fixed.
205
+                   */ }
206
+                <FieldText
199
                     className = 'input-control dial-out-code'
207
                     className = 'input-control dial-out-code'
200
-                    readOnly = { true }
208
+                    isLabelHidden = { true }
209
+                    isReadOnly = { true }
210
+                    label = 'dial-out-code'
201
                     type = 'text'
211
                     type = 'text'
202
                     value = { dialCode || '' } />
212
                     value = { dialCode || '' } />
203
                 <span className = 'dropdown-trigger-icon'>
213
                 <span className = 'dropdown-trigger-icon'>

Loading…
取消
儲存