| 1 |
/** |
| 2 |
* WordPress dependencies |
| 3 |
*/ |
| 4 |
import { Rect, SVG } from '@wordpress/components'; |
| 5 |
|
| 6 |
/** |
| 7 |
* Props structure for VerticalDivider. |
| 8 |
* |
| 9 |
* @since 3.19.0 |
| 10 |
*/ |
| 11 |
interface VerticalDividerProps { |
| 12 |
size?: number; |
| 13 |
color?: string; |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Returns a vertical divider component. |
| 18 |
* |
| 19 |
* @since 3.14.0 |
| 20 |
* @since 3.16.0 Moved from `RelatedPostItem` and `TitleSuggestion`. |
| 21 |
* @since 3.19.0 Added size prop. |
| 22 |
* @since 3.20.0 Added color prop. |
| 23 |
* |
| 24 |
* @param {VerticalDividerProps} props The component's props. |
| 25 |
* |
| 26 |
* @return {import('react').JSX.Element} The vertical divider component. |
| 27 |
*/ |
| 28 |
export const VerticalDivider = ( { size = 40, color = '#cccccc' }: VerticalDividerProps ): JSX.Element => { |
| 29 |
return <> |
| 30 |
{ /* Use 3px width instead of 1px to ensure the divider is visible on all browsers. */ } |
| 31 |
<SVG xmlns="http://www.w3.org/2000/svg" width="3" height={ size } viewBox={ `0 0 1 ${ size }` } fill="none"> |
| 32 |
<Rect width="1" height={ size } fill={ color } /> |
| 33 |
</SVG> |
| 34 |
</>; |
| 35 |
}; |
| 36 |
|