ExamplesPlaygroundReference Source

coral-spectrum/coral-component-shell/src/scripts/ShellSuborganization.js

  1. /**
  2. * Copyright 2019 Adobe. All rights reserved.
  3. * This file is licensed to you under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License. You may obtain a copy
  5. * of the License at http://www.apache.org/licenses/LICENSE-2.0
  6. *
  7. * Unless required by applicable law or agreed to in writing, software distributed under
  8. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
  9. * OF ANY KIND, either express or implied. See the License for the specific language
  10. * governing permissions and limitations under the License.
  11. */
  12.  
  13. import ShellOrganization from './ShellOrganization';
  14. import {Icon} from '../../../coral-component-icon';
  15.  
  16. const CLASSNAME = '_coral-Shell-orgSwitcher-subitem';
  17.  
  18. /**
  19. @class Coral.Shell.Suborganization
  20. @classdesc A Shell Sub organization component
  21. @htmltag coral-shell-suborganization
  22. @extends {ShellOrganization}
  23. */
  24. class ShellSuborganization extends ShellOrganization {
  25. /** @ignore */
  26. render() {
  27. super.render();
  28.  
  29. this.classList.add(CLASSNAME);
  30.  
  31. // Set the icon size
  32. this._elements.icon.size = Icon.size.SMALL;
  33.  
  34. // Be accessible
  35. this.setAttribute('role', 'button');
  36. this.setAttribute('tabindex', 0);
  37. }
  38. }
  39.  
  40. export default ShellSuborganization;