From edd18a644608cf07cfafcd7edbff73d7133835be Mon Sep 17 00:00:00 2001 From: Greg Douglas Date: Thu, 12 Dec 2024 10:59:49 -0500 Subject: [PATCH] [docs] Rewrite Divider docs (#7124) --- .../core/src/components/divider/divider.md | 27 ++++++++-- .../examples/core-examples/dividerExample.tsx | 54 ------------------- .../core-examples/dividerExamples.tsx | 47 ++++++++++++++++ .../dividerPlaygroundExample.tsx | 46 ++++++++++++++++ .../src/examples/core-examples/index.ts | 5 +- packages/docs-app/src/styles/_examples.scss | 13 +++++ 6 files changed, 132 insertions(+), 60 deletions(-) delete mode 100644 packages/docs-app/src/examples/core-examples/dividerExample.tsx create mode 100644 packages/docs-app/src/examples/core-examples/dividerExamples.tsx create mode 100644 packages/docs-app/src/examples/core-examples/dividerPlaygroundExample.tsx diff --git a/packages/core/src/components/divider/divider.md b/packages/core/src/components/divider/divider.md index deb62a6a33..85742db094 100644 --- a/packages/core/src/components/divider/divider.md +++ b/packages/core/src/components/divider/divider.md @@ -1,11 +1,30 @@ @# Divider -__Divider__ visually separate contents with a thin line and margin on all sides. +**Divider** visually separate contents with a thin line and margin on all sides. +It works best in flex layouts where they will adapt to orientation without +additional styles. Otherwise, a **Divider** will appear as a full-width 1px-high block element. -Dividers work best in flex layouts where they will adapt to orientation without additional styles. Otherwise, a -divider will appear as a full-width 1px-high block element. +@## Import -@reactExample DividerExample +```tsx +import { Divider } from "@blueprintjs/core"; +``` + +@## Usage + +Use **Divider** to separate blocks of content within a page or container. By default, it spans the full width of its container. + +@reactCodeExample DividerBasicExample + +@## Vertical + +When used inside a flex container, **Divider** adapts to the layout's direction. It becomes a vertical divider when placed between flex items. + +@reactCodeExample DividerVerticalExample + +@## Interactive Playground + +@reactExample DividerPlaygroundExample @## Props interface diff --git a/packages/docs-app/src/examples/core-examples/dividerExample.tsx b/packages/docs-app/src/examples/core-examples/dividerExample.tsx deleted file mode 100644 index 1dbdc3e4ee..0000000000 --- a/packages/docs-app/src/examples/core-examples/dividerExample.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2015 Palantir Technologies, Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with 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 * as React from "react"; - -import { Button, ButtonGroup, Divider, H5, Switch } from "@blueprintjs/core"; -import { Example, type ExampleProps, handleBooleanChange } from "@blueprintjs/docs-theme"; - -export interface DividerExampleState { - vertical: boolean; -} - -export class DividerExample extends React.PureComponent { - public state: DividerExampleState = { vertical: false }; - - private handleVerticalChange = handleBooleanChange(vertical => this.setState({ vertical })); - - public render() { - const { vertical } = this.state; - const options = ( - <> -
Example props
- - - ); - return ( - - -