Files
jitsi-meet/react/features/calendar-sync/components/JoinButton.web.js
Steffen Kolmer e9675453e1 feat: Make Jitsi WCAG 2.1 compliant (#8921)
* Make Jitsi WCAG 2.1 compliant

* Fixed password form keypress handling

* Added keypress handler to name form

* Removed unneccessary dom query

* Fixed mouse hove style

* Removed obsolete css rules

* accessibilty background feature

* Merge remote-tracking branch 'upstream/master' into nic/fix/merge-conflicts

* fix error

* add german translation

* Fixed merge issue

* Add id prop back to device selection

* Fixed lockfile

Co-authored-by: AHMAD KADRI <52747422+ahmadkadri@users.noreply.github.com>
2021-06-10 07:48:44 -05:00

106 lines
2.4 KiB
JavaScript

// @flow
import React, { Component } from 'react';
import { translate } from '../../base/i18n';
import { Icon, IconAdd } from '../../base/icons';
import { Tooltip } from '../../base/tooltip';
/**
* The type of the React {@code Component} props of {@link JoinButton}.
*/
type Props = {
/**
* The function called when the button is pressed.
*/
onPress: Function,
/**
* The meeting URL associated with the {@link JoinButton} instance.
*/
url: string,
/**
* Invoked to obtain translated strings.
*/
t: Function
};
/**
* A React Component for joining an existing calendar meeting.
*
* @extends Component
*/
class JoinButton extends Component<Props> {
/**
* Initializes a new {@code JoinButton} instance.
*
* @param {*} props - The read-only properties with which the new instance
* is to be initialized.
*/
constructor(props) {
super(props);
// Bind event handler so it is only bound once for every instance.
this._onClick = this._onClick.bind(this);
this._onKeyPress = this._onKeyPress.bind(this);
}
/**
* Implements React's {@link Component#render}.
*
* @inheritdoc
*/
render() {
const { t } = this.props;
return (
<Tooltip
content = { t('calendarSync.joinTooltip') }>
<div
className = 'button join-button'
onClick = { this._onClick }
onKeyPress = { this._onKeyPress }
role = 'button'>
<Icon
size = '14'
src = { IconAdd } />
</div>
</Tooltip>
);
}
_onClick: (Object) => void;
/**
* Callback invoked when the component is clicked.
*
* @param {Object} event - The DOM click event.
* @private
* @returns {void}
*/
_onClick(event) {
this.props.onPress(event, this.props.url);
}
_onKeyPress: (Object) => void;
/**
* KeyPress handler for accessibility.
*
* @param {Object} e - The key event to handle.
*
* @returns {void}
*/
_onKeyPress(e) {
if (e.key === ' ' || e.key === 'Enter') {
e.preventDefault();
this._onClick();
}
}
}
export default translate(JoinButton);