Skip to content

Commit

Permalink
Develop (#17)
Browse files Browse the repository at this point in the history
fix: images max width,select input
  • Loading branch information
OriAmir authored May 15, 2022
1 parent 6ae5c6d commit 929d30f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ or
<a href="https://react-responsive-gallery-demo.herokuapp.com" target="_blank"> Try out the live gallery demo .</a>
<i>(it's take few seconds until app is loading)</i><br/>
* Some of the gallery features are not available in the live demo : cols padding , imagesStyle and images order(s,m,l).
<br/><br/>

<h3>Playground</h3>
You can play with the library in
<a href="https://codesandbox.io/s/react-responsive-gallery-playground-dpqtg?file=/src/App.js" target="_blank"> this sandbox playground .</a>
<a href="https://codesandbox.io/s/react-responsive-gallery-playground-dpqtg" target="_blank"> Codesandbox</a> or in
<a href="https://stackblitz.com/edit/react-responsive-gallery" target="_blank"> Stackblitz</a> .

<br/>
<h3>Basic using example</h3>
Expand Down
4 changes: 2 additions & 2 deletions 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": "react-responsive-gallery",
"version": "2.1.0",
"version": "2.1.1",
"description": "React responsive gallery",
"main": "dist/index.js",
"repository": {
Expand Down
1 change: 1 addition & 0 deletions src/components/Gallery/Gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const Gallery = ({
id={img?.id || img.src}
selectableItems={selectableItems}
onSelect={onSelect}
imagesMaxWidth={gallerySizes.imagesMaxWidth}
/>
)}
<Image
Expand Down
15 changes: 11 additions & 4 deletions src/components/Gallery/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@ const StyledCheckbox = styled.input.attrs<CheckboxProps>(
})
)<CheckboxProps>``;

const StyledDiv = styled.div`
const StyledDiv = styled.div<{ imagesMaxWidth: number }>`
position: absolute;
top: 5px;
right: 15px;
${(props) =>
props.imagesMaxWidth &&
`left: calc(${props.imagesMaxWidth}% - 28px - 5px);`}
`;

const Select = ({ id, selectableItems, onSelect }: SelectProps) => {
const Select = ({
id,
selectableItems,
onSelect,
imagesMaxWidth,
}: SelectProps) => {
const [selectedValues, selectDispatch] = useReducer(
selectReducer,
convertSelectableItems(selectableItems) || selectInitialState
Expand All @@ -41,7 +48,7 @@ const Select = ({ id, selectableItems, onSelect }: SelectProps) => {
};

return (
<StyledDiv>
<StyledDiv imagesMaxWidth={imagesMaxWidth}>
<StyledSelect>
<StyledCheckbox
className="select-input"
Expand Down
1 change: 1 addition & 0 deletions src/components/Gallery/Select/Select.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export type SelectProps = {
id: string;
selectableItems?: Array<string>;
onSelect?: (id: string, val: boolean) => void;
imagesMaxWidth: number;
};

0 comments on commit 929d30f

Please sign in to comment.