how can I wrap my list items in an accordion and set the height of accordion based on the number of items list has? using css and styled components - css

I have a list of 6 Services and I want to wrap each service list in Accordion. Whenever the user clicks the "+" button for the specific service I want that list to be displayed with slides down with a growing margin-bottom, depending on the number of items in the respective list without overlapping the below element. The problem is now it overlaps the below elements. Kindly check my code in code sandbox.
codesandbox link

Related

CSS selector to target rows in grid

I have been working on an expandable card that has a dynamic number of rows and columns depending on the content length and width of the container. I want the card to first be in collapsed view where only the first row is displayed and expand to show the full card when the user toggles the card. I am wondering if there is an option to hide all rows except the first one using CSS based on conditional class added on button toggle if not what would be the ideal solution to handle this using javascript? bear in mind the number of columns in a row will change based on screen size.
sample code sandbox

Adding animation in redux

I am currently building a small web page using react-redux. In my page I am rendering two containers. One container has a button that on clicking causes a change in the state and as a result the content in the other container also changes e.g initially there is a div container with text hello my name is rishi bhatia. As soon as I click on the button the a separate div container with 4 links replaces the previously displayed div container. What are the possible ways in which I can add animations when the content in the container changes. All I am doing is displaying different div containers on state change.
You can implement componentWillReceiveProps(nextProps). Here you can define your animation when component receive props playing with state.
Even if your component is just presentational id doesn't mean it cannot use state for graphical purposes.

css - z-index : list with hidden box

I have a list where every element has a share button, when I press on the
share button a box/bubble opens up with the social mdia buttons.
when the share box opens it should go over the list items (even if it covers the next elements on the list), how can I achieve that?
current state
The box shouldn't push the height of the item list it should be on top of everything

CSS list into a scrolling div - How to autofocus on selected/active <li>?

I have a list contained into a scrolling div with fixed height. When I go to the selected page clicking on a category, I want the user to see the current selected category auto focused at its position. that is, the user has not to see the list from the beginning, but focused on the current position. How to do it?

Flex horizontal tile list

I am using a horizontal tilelist in flex to display an image gallery with only one item in horiz. tilelist being shown at a time. I have next and previous buttons on both sides.
The problem is I want to display a particular item/image in that list when user clicks on a thumb image from another thumbimages tilelist at bottom.
I used someTilelist.selectedIndex property but it just selects that particular index in list, it does not show that particular item/image. I want the list to show that particular image, not just select it. Please take note that the horiz. tilelist shows only one image at time.
tilelist.scrollToIndex(index);

Resources