/* * Copyright 2016 Palantir Technologies, Inc. All rights reserved. * Licensed under the BSD-3 License as modified (the “License”); you may obtain a copy * of the license at https://github.com/palantir/blueprint/blob/master/LICENSE * and https://github.com/palantir/blueprint/blob/master/PATENTS */ import * as classNames from "classnames"; import * as React from "react"; import { Classes, CollapseFrom, CollapsibleList, IMenuItemProps, MenuItem, RadioGroup, Slider, } from "@blueprintjs/core"; import BaseExample, { handleNumberChange } from "./common/baseExample"; export interface ICollapsibleListExampleState { collapseFrom?: CollapseFrom; visibleItemCount?: number; } const COLLAPSE_FROM_RADIOS = [ { className: Classes.INLINE, label: "Start", value: CollapseFrom.START.toString() }, { className: Classes.INLINE, label: "End", value: CollapseFrom.END.toString() }, ]; export class CollapsibleListExample extends BaseExample { public state: ICollapsibleListExampleState = { collapseFrom: CollapseFrom.START, visibleItemCount: 3, }; private handleChangeCollapse = handleNumberChange((collapseFrom) => this.setState({ collapseFrom })); protected renderExample() { return ( } renderVisibleItem={this.renderBreadcrumb} > ); } protected renderOptions() { return [ [ , , ], [ , ], ]; } private renderBreadcrumb(props: IMenuItemProps) { if (props.href != null) { return {props.text}; } else { return {props.text}; } } private handleChangeCount = (visibleItemCount: number) => this.setState({ visibleItemCount }); }