Skip to content

Commit

Permalink
Apply some integration improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Apr 30, 2021
1 parent cb82cfe commit 233cbb7
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 21 deletions.
22 changes: 19 additions & 3 deletions packages/components/src/h-stack/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# HStack

> **Experimental!**
`HStack` (Horizontal Stack) arranges child elements in a horizontal line.

## Usage

`HStack` can render anything inside.

```jsx
import { HStack, Text, View } from '@wordpress/components/ui';
import {
__experimentalHStack as HStack,
__experimentalText as Text,
__experimentalView as View,
} from '@wordpress/components';

function Example() {
return (
Expand Down Expand Up @@ -83,7 +89,12 @@ Determines if children should wrap.
When a `Spacer` is used within an `HStack`, the `Spacer` adaptively expands to take up the remaining space.

```jsx
import { HStack, Spacer, Text, View } from '@wordpress/components/ui';
import {
__experimentalHStack as HStack,
__experimentalSpacer as Spacer,
__experimentalText as Text,
__experimentalView as View,
} from '@wordpress/components';

function Example() {
return (
Expand All @@ -105,7 +116,12 @@ function Example() {
`Spacer` also be used in-between items to push them apart.

```jsx
import { HStack, Spacer, Text, View } from '@wordpress/components/ui';
import {
__experimentalHStack as HStack,
__experimentalSpacer as Spacer,
__experimentalText as Text,
__experimentalView as View,
} from '@wordpress/components';

function Example() {
return (
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/h-stack/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import { useHStack } from './hook';
*
* @example
* ```jsx
* import { HStack, Text, View } from `@wordpress/components/ui`;
* import {
* __experimentalHStack as HStack,
* __experimentalText as Text,
* __experimentalView as View,
* } from `@wordpress/components`;
*
* function Example() {
* return (
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/h-stack/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default } from './component';
export * from './hook';
export { default as HStack } from './component';
export { useHStack } from './hook';
2 changes: 1 addition & 1 deletion packages/components/src/h-stack/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Internal dependencies
*/
import { View } from '../../view';
import { HStack } from '../index';
import { HStack } from '..';

export default {
component: HStack,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/h-stack/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { render } from '@testing-library/react';
/**
* Internal dependencies
*/
import { View } from '../ui/view';
import { View } from '../../ui/view';
import { HStack } from '..';

describe( 'props', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/h-stack/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { CSSProperties } from 'react';
/**
* Internal dependencies
*/
import type { FlexProps } from '../../flex/types';
import type { FlexProps } from '../flex/types';

export type HStackAlignment =
| 'bottom'
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/h-stack/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const V_ALIGNMENTS = {
/* eslint-disable jsdoc/valid-types */
/**
* @param {import('./types').HStackAlignment | import('react').CSSProperties[ 'alignItems' ]} alignment Where to align.
* @param {import('../../flex/types').FlexDirection} [direction='row'] Direction to align.
* @param {import('../flex/types').FlexDirection} [direction='row'] Direction to align.
* @return {import('./types').AlignmentProps} Alignment props.
*/
/* eslint-enable jsdoc/valid-types */
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export { default as __experimentalCustomGradientPicker } from './custom-gradient
export { default as Guide } from './guide';
export { default as GuidePage } from './guide/page';
export { Heading as __experimentalHeading } from './heading';
export { default as __experimentalHStack } from './h-stack';
export { HStack as __experimentalHStack } from './h-stack';
export { default as Icon } from './icon';
export { default as IconButton } from './button/deprecated';
export { default as __experimentalInputControl } from './input-control';
Expand Down Expand Up @@ -126,7 +126,7 @@ export { default as TreeSelect } from './tree-select';
export { Truncate as __experimentalTruncate } from './truncate';
export { default as __experimentalUnitControl } from './unit-control';
export { default as VisuallyHidden } from './visually-hidden';
export { default as __experimentalVStack } from './v-stack';
export { VStack as __experimentalVStack } from './v-stack';
export { default as IsolatedEventContainer } from './isolated-event-container';
export {
createSlotFill,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Grid } from '../grid';
import { Surface } from '../surface';
import { Text } from '../../text';
import { View } from '../view';
import VStack from '../../v-stack';
import { VStack } from '../../v-stack';

const Container = ( { children } ) => (
<div
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/ui/__storybook-utils/page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import VStack from '../../v-stack';
import { VStack } from '../../v-stack';
import { View } from '../view';
import { Heading } from '../../heading';
import { Divider } from '../divider';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useMemo, memo } from '@wordpress/element';
/**
* Internal dependencies
*/
import VStack from '../../v-stack';
import { VStack } from '../../v-stack';
import { FormGroupContext } from './form-group-context';
import FormGroupHelp from './form-group-help';
import FormGroupLabel from './form-group-label';
Expand Down
22 changes: 21 additions & 1 deletion packages/components/src/v-stack/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# VStack

> **Experimental!**
`VStack` (or Vertical Stack) is a layout component that arranges child elements in a vertical line.

## Usage

`VStack` can render anything inside.

```jsx
import { VStack, Text, View } from '@wordpress/components';
import {
__experimentalText as Text,
__experimentalView as View
__experimentalVStack as VStack,
} from '@wordpress/components';

function Example() {
return (
Expand Down Expand Up @@ -83,6 +89,13 @@ Determines if children should wrap.
When a `Spacer` is used within an `VStack`, the `Spacer` adaptively expands to take up the remaining space.

```jsx
import {
__experimentalSpacer as Text,
__experimentalText as Text,
__experimentalView as View
__experimentalVStack as VStack,
} from '@wordpress/components';

function Example() {
return (
<VStack>
Expand All @@ -103,6 +116,13 @@ function Example() {
`Spacer` can also be used in-between items to push them apart.

```jsx
import {
__experimentalSpacer as Text,
__experimentalText as Text,
__experimentalView as View
__experimentalVStack as VStack,
} from '@wordpress/components';

function Example() {
return (
<VStack>
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/v-stack/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import { useVStack } from './hook';
*
* @example
* ```jsx
* import { VStack, Text, View } from `@wordpress/components`;
* import {
* __experimentalText as Text,
* __experimentalView as View,
* __experimentalVStack as VStack,
* } from `@wordpress/components`;
*
* function Example() {
* return (
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/v-stack/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default } from './component';
export * from './hook';
export { default as VStack } from './component';
export { useVStack } from './hook';
4 changes: 2 additions & 2 deletions packages/components/src/v-stack/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { render } from '@testing-library/react';
/**
* Internal dependencies
*/
import { View } from '../../view';
import VStack from '../index';
import { View } from '../../ui/view';
import { VStack } from '..';

describe( 'props', () => {
test( 'should render correctly', () => {
Expand Down

0 comments on commit 233cbb7

Please sign in to comment.