Skip to content

Commit

Permalink
Merge pull request #128 from GeekyAnts/feat/aspect-ratio-docs
Browse files Browse the repository at this point in the history
Feat AspectRatio docs
  • Loading branch information
md-rehman authored Oct 29, 2021
2 parents 5441ee3 + c84e829 commit 2b2afbe
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 78 deletions.
32 changes: 32 additions & 0 deletions docs/aspectRatio.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
id: aspectRatio
title: AspectRatio
---

Aspect ratio controls the size of the undefined dimension of a node or child component. You can refer [mozilla.org](https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio) for more details.

## Import

```jsx
import { AspectRatio } from 'native-base';
```

## Example

### Basic

```ComponentSnackPlayer path=components,composites,AspectRatio,Basic.tsx

```

### Embed Image

```ComponentSnackPlayer path=components,composites,AspectRatio,EmbedImage.tsx

```

## Props

```ComponentPropTable path=composites,AspectRatio,index.tsx

```
30 changes: 27 additions & 3 deletions nb-plugins/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,38 @@ const prettier = require('prettier');

const repoPath = path.resolve(__dirname, '..', '..', 'NativeBase');

const storybookExamplePath = (repoPath) =>
path.resolve(repoPath, 'example', 'storybook', 'stories');
function getRepoVersion(directory) {
if (directory.includes('versioned_repo')) {
return directory.split('versioned_repo/')[1].split('/')[0];
}

return 'next';
}
const storybookExamplePath = (repoPath) => {
return path.resolve(repoPath, 'example', 'storybook', 'stories');
};
const componentsRootPath = (repoPath) =>
path.resolve(repoPath, 'src', 'components');

const olderVersionSupport = [
'3.2.1',
'3.1.0',
'3.0.7',
'3.0.6',
'3.0.3',
'3.0.0',
'3.0.0-next.40',
'3.0.0-next.38',
'3.0.0-next.37',
'3.0.0-next.36',
];
const getSnackPlayerCodeSnippet = (repoPath, ...examplePath) => {
// console.log('snippet args received', args);
const filePath = path.resolve(storybookExamplePath(repoPath), ...examplePath);
const filePath = path.resolve(
storybookExamplePath(repoPath),
olderVersionSupport.includes(getRepoVersion(repoPath)) ? 'components' : '', // add components older version docs.
...examplePath
);
const fileContent = fs.readFileSync(filePath, { encoding: 'utf-8' });
try {
let transformedFile = transformStorybookToDocExample(
Expand Down
2 changes: 1 addition & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = {
label: 'Layout',
collapsed: false,
items: [
// 'aspectRatio',
'aspectRatio',
'box',
'center',
'container',
Expand Down
74 changes: 0 additions & 74 deletions unreleased-docs/aspectRatio.md

This file was deleted.

0 comments on commit 2b2afbe

Please sign in to comment.