-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathchevron.js
39 lines (33 loc) · 1020 Bytes
/
chevron.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Component from '@glimmer/component';
import { assert } from '@ember/debug';
const DIRECTIONS = ['right', 'left', 'up', 'down'];
/**
* @deprecated
* @module Chevron
* * Use HDS icons instead
* Chevron components render Icon with one of the "chevron-" glyphs.
*
* @example
* <Chevron @direction="up" />
*
* @param {string} [direction="right"] - the direction the chevron icon points. Accepted values are "right", "down", "left", "up".
* @param {string} [isButton=false] - if true, adjusts the CSS classes to push the icon closer to the right of a button.
*
*/
export default class Chevron extends Component {
get direction() {
return this.args.direction || 'right';
}
get glyph() {
const { direction } = this;
assert(
`The direction property of Chevron must be one of the following: ${DIRECTIONS.join(', ')}`,
DIRECTIONS.includes(direction)
);
return `chevron-${direction}`;
}
}