@okta/okta-signin-widget
Version:
The Okta Sign-In Widget
40 lines (36 loc) • 1.46 kB
JavaScript
/*!
* Copyright (c) 2020, Okta, Inc. and/or its affiliates. All rights reserved.
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
*
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and limitations under the License.
*/
import { View, $ } from '@okta/courage';
import Link from './Link';
export default View.extend({
initialize() {
View.prototype.initialize.apply(this, arguments);
const textViewOptions = this.options.additionalOptions;
const linkName = this.options.name;
const linkOptions = Object.assign({}, this.options,
{
'type': 'link',
'aria-expanded': false,
'clickHandler': function() {
$(textViewOptions.selector).slideToggle(200, () => {
$(`.js-${linkName}`).attr('aria-expanded', $(textViewOptions.selector).is(':visible'));
});
}
});
this.add(Link, { options: linkOptions });
this.add(textViewOptions.view);
},
postRender() {
const textViewOptions = this.options.additionalOptions;
this.$(textViewOptions.selector).hide();
},
});