浏览代码

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,20 +4,29 @@
4 4
 .dial-out-content {
5 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 15
     * The style of the flag icon.
9 16
     */
10 17
     .dial-out-flag-icon {
11 18
         position: absolute;
12 19
         left: 5px;
13
-        top: 10px;
20
+        top: 50%;
21
+        transform: translate(0, -50%);
14 22
     }
15 23
 
16 24
     /**
17 25
      * The style of the dial code element.
18 26
      */
19 27
     .dial-out-code {
20
-        padding-left: 25px !important;
28
+        margin-bottom: 0;
29
+        padding-left: 25px;
21 30
     }
22 31
 
23 32
     /**
@@ -31,34 +40,42 @@
31 40
      * The style of the dial input element.
32 41
      */
33 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 49
      * Re-styling the default dropdown inside the dial-out-content.
39 50
      */
40 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 57
      * Re-styling the default form-control inside the dial-out-content.
48 58
      */
49 59
     .form-control {
50
-        padding-bottom: 8px !important;
60
+        margin-bottom: 8px;
51 61
     }
52 62
 
53 63
     .dropdown {
54
-        display: inline-block;
55 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 75
     .dropdown-trigger-icon {
60 76
         position: absolute;
61 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,4 +1,5 @@
1 1
 import { StatelessDropdownMenu } from '@atlaskit/dropdown-menu';
2
+import AKFieldText, { FieldText } from '@atlaskit/field-text';
2 3
 import ExpandIcon from '@atlaskit/icon/glyph/expand';
3 4
 import React, { Component } from 'react';
4 5
 import { connect } from 'react-redux';
@@ -146,13 +147,14 @@ class DialOutNumbersForm extends Component {
146 147
             <div className = 'form-control'>
147 148
                 { this._createDropdownMenu(items) }
148 149
                 <div className = 'dial-out-input'>
149
-                    <input
150
+                    <AKFieldText
150 151
                         autoFocus = { true }
151
-                        className = 'input-control'
152
+                        isLabelHidden = { true }
153
+                        label = { 'dial-out-input-field' }
152 154
                         onChange = { this._onInputChange }
153 155
                         placeholder = { t('dialOut.enterPhone') }
154 156
                         ref = { this._setDialInputElement }
155
-                        type = 'text' />
157
+                        shouldFitContainer = { true } />
156 158
                 </div>
157 159
             </div>
158 160
         );
@@ -168,14 +170,16 @@ class DialOutNumbersForm extends Component {
168 170
         const { code, dialCode } = this.state.selectedCountry;
169 171
 
170 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,9 +199,15 @@ class DialOutNumbersForm extends Component {
195 199
                 <CountryIcon
196 200
                     className = 'dial-out-flag-icon'
197 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 207
                     className = 'input-control dial-out-code'
200
-                    readOnly = { true }
208
+                    isLabelHidden = { true }
209
+                    isReadOnly = { true }
210
+                    label = 'dial-out-code'
201 211
                     type = 'text'
202 212
                     value = { dialCode || '' } />
203 213
                 <span className = 'dropdown-trigger-icon'>

正在加载...
取消
保存