|
| 1 | +/* |
| 2 | +Copyright 2022 The Matrix.org Foundation C.I.C. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +import React from 'react'; |
| 18 | +import classNames from 'classnames'; |
| 19 | + |
| 20 | +import { Icon as UnknownDeviceIcon } from '../../../../../res/img/element-icons/settings/unknown-device.svg'; |
| 21 | +import { Icon as VerifiedIcon } from '../../../../../res/img/e2e/verified.svg'; |
| 22 | +import { Icon as UnverifiedIcon } from '../../../../../res/img/e2e/warning.svg'; |
| 23 | +import { _t } from '../../../../languageHandler'; |
| 24 | +import { DeviceWithVerification } from './types'; |
| 25 | + |
| 26 | +interface Props { |
| 27 | + isVerified?: DeviceWithVerification['isVerified']; |
| 28 | + isSelected?: boolean; |
| 29 | +} |
| 30 | + |
| 31 | +export const DeviceType: React.FC<Props> = ({ isVerified, isSelected }) => ( |
| 32 | + <div className={classNames('mx_DeviceType', { |
| 33 | + mx_DeviceType_selected: isSelected, |
| 34 | + })} |
| 35 | + > |
| 36 | + { /* TODO(kerrya) all devices have an unknown type until PSG-650 */ } |
| 37 | + <UnknownDeviceIcon |
| 38 | + className='mx_DeviceType_deviceIcon' |
| 39 | + role='img' |
| 40 | + aria-label={_t('Unknown device type')} |
| 41 | + /> |
| 42 | + { |
| 43 | + isVerified |
| 44 | + ? <VerifiedIcon |
| 45 | + className={classNames('mx_DeviceType_verificationIcon', 'verified')} |
| 46 | + role='img' |
| 47 | + aria-label={_t('Verified')} |
| 48 | + /> |
| 49 | + : <UnverifiedIcon |
| 50 | + className={classNames('mx_DeviceType_verificationIcon', 'unverified')} |
| 51 | + role='img' |
| 52 | + aria-label={_t('Unverified')} |
| 53 | + /> |
| 54 | + } |
| 55 | + </div>); |
| 56 | + |
0 commit comments