How to use the ember-css-modules.localClassName function in ember-css-modules

To help you get started, we’ve selected a few ember-css-modules examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CenterForOpenScience / ember-osf-web / lib / osf-components / addon / components / file-browser-item / component.ts View on Github external
* ```
 * @class file-icon
 */
@layout(template, styles)
@classNames('container')
@localClassNames('file-browser-item')
export default class FileBrowserItem extends Component {
    @service analytics!: Analytics;
    @service store!: DS.Store;

    item?: File;
    @requiredAction openItem!: (item: File | undefined, show: string) => void;
    @requiredAction selectItem!: (item: File | undefined) => void;
    @requiredAction selectMultiple!: (item: File | undefined, metaKey: boolean) => void;

    @localClassName()
    @computed('item.isSelected')
    get selected(): boolean {
        return !!this.item && this.item.isSelected;
    }

    @computed('item.size')
    get size(): string {
        // TODO: This should be i18n-ized
        return this.item && this.item.size ? humanFileSize(this.item.size, true) : '';
    }

    @computed('item.dateModified')
    get date(): string {
        // TODO: This should be i18n-ized
        return this.item ? moment(this.item.dateModified).format('YYYY-MM-DD h:mm A') : '';
    }
github CenterForOpenScience / ember-osf-web / lib / osf-components / addon / components / file-list-item / component.ts View on Github external
*    file=file
 *    selectItem=(action 'selectItem') - Action handling clicking on the body of the row
 *    openItem=(action 'openItem') - Action handling clicking the link-name of the file
 * }}
 * ```
 * @class file-icon
 */
@layout(template)
@localClassNames('FileListItem')
export default class FileListItem extends Component.extend({ styles }) {
    @service store!: DS.Store;

    item?: File;
    @requiredAction openItem!: (item: File | undefined) => void;

    @localClassName()
    @computed('item.isSelected')
    get selected(): boolean {
        return !!this.item && this.item.isSelected;
    }

    @computed('item.guid')
    get link(): string {
        return this.item && this.item.guid ? pathJoin(window.location.origin, this.item.guid) : '';
    }

    @action
    open(ev?: Event) {
        if (ev) {
            ev.stopPropagation();
        }
        this.openItem(this.item);

ember-css-modules

CSS Modules for ambitious applications

MIT
Latest version published 8 months ago

Package Health Score

61 / 100
Full package analysis