Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/600319 #355

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Precise UI Changelog

## 2.1.5

- Fixed `Navigation` behavior when `Carousel` contains only one `Page`: `Bullets` disabled (#600319)

## 2.1.4

- Updated `Highlight` component to have optional highlight prop (#280)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "precise-ui",
"version": "2.1.4",
"version": "2.1.5",
"description": "Precise UI React component library powered by Styled Components.",
"keywords": [
"react",
Expand Down
15 changes: 15 additions & 0 deletions src/components/Carousel/Example.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ const { Carousel } = require('precise-ui');
</Carousel>
```

**Single page**

Example of the basic `Carousel` component usage. Only one page present (`Bullets` disabled).

```jsx
const { Carousel } = require('precise-ui');

<Carousel infinite>
<div style={{ height: '150px', width: '100%', backgroundColor: '#f3a', display: 'flex', justifyContent: 'center', alignItems: 'center'}}>
First page
</div>
</Carousel>
```


**Controlled Mode**

An example with controlled mode and page open by default. In this mode component behavior is controlled by code exclusively.
Expand Down
6 changes: 3 additions & 3 deletions src/components/Carousel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import styled, { css } from '../../utils/styled';
import { KeyCodes } from '../../utils/keyCodes';
import { remCalc } from '../../utils/remCalc';
import { KeyCodes, remCalc } from '../../utils';
FlorianRappl marked this conversation as resolved.
Show resolved Hide resolved
import { InteractiveSurface, InteractiveSurfaceChangeEvent, InteractiveSurfaceProps } from '../InteractiveSurface';
import { Icon } from '../Icon';
import { StandardProps } from '../../common';
Expand Down Expand Up @@ -452,6 +451,7 @@ export class Carousel extends React.PureComponent<CarouselProps, CarouselState>

const disableLeft = !infinite && selectedIndex < 1;
const disableRight = !infinite && selectedIndex > childrenCount - 2;
const enableBullets = bullets && bullets.length > 1;

return (
<RootContainer {...props} onKeyDown={this.handleKeyDown} tabIndex={0}>
Expand All @@ -474,7 +474,7 @@ export class Carousel extends React.PureComponent<CarouselProps, CarouselState>
</div>
)}
</Mask>
<BulletsContainer>{bullets}</BulletsContainer>
{enableBullets && <BulletsContainer>{bullets}</BulletsContainer>}
</RootContainer>
);
}
Expand Down