Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
How can I create view more and make my word stand in same line?

I'm having an issues with css that my "Room Description" is splitting 2 line.

enter image description here

When I add white-space: nowrap it become like this:

enter image description here

Here is my code base:

  <span className="room-type mv-print-link">
    {this.props.waitlistRooms.map((room: any, i: any) => (
        <div>
        {this.props.waitlistRooms.length > 0 ? &&
          <span
            onClick={() => this.toggleRoomModal(resortId || "", room.roomPoolCode)}
            key={i}
          >
            <b>{"Room Description, "}</b>
          </span>
        )
        </div>
      ))}

css file:

.room-type-container
    display: flex
    flex-direction: column
    margin-bottom: 15px
    .room-type
        display: flex
        flex-direction: row
        flex-shrink: 0
        width: 300px

How can I achieve when there is more than 3 rooms and it will appear View More button? Thanks for helping me

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

so the mechanic you want should work like this:

  • when you have only 3 (or any other default) rooms, just show them. lets say you have a list of rooms, so something like:

{roomsList.map((room) => <span>{room.name}: {room.description})}

now, if you have more than the default rooms number (3 in our case), you want to render also the rest, but out of the view. in order to accomplish this, you should do the follow:

  • split your array in 2: first-3-items, rest-of-items.
  • render first array.
  • if the length of the second array is bigger than 0, render a 'View More' button using react-collapsible (which makes the collapsible behaviour you desire) and inside of it render the rest of the rooms.

in a quick example it should look something like this:

//after splitting the array you will have: 

const roomsArray1 = [{name:' roomA', description: 'niceA'},{name:' roomB', description: 'niceB'},{name:' roomC', description: 'niceC'}
const roomsArray2 = [{name:' roomD', description: 'niceD'},{name:' roomE', description: 'niceE'}];


{roomsArray1.map((room) => <span>{room.name}: {room.description})</span>}
{roomsArray2.length > 0 && 
  <Collapsible trigger="View More">
    {roomsArray2.map((room) => <span>{room.name}: {room.description})</span>}
  </Collapsible>
    

You can add styles as you like (spaces, colors, etc..)

By this, you will only show only part of the rooms, and by clicking the 'View More' button, more will appear.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!