Conceal flex items when there is inadequate space available

I need help with customizing my JIRA timeline chart to show information about epics in progress. When an epic spans multiple releases, there is enough space on the timeline bar to display all relevant details. However, if an epic only spans one release, the limited space cuts off some information (such as "Open" in the example below):

https://i.sstatic.net/lpZ4C.png

In cases where space is restricted, I would like to hide the JIRA ticket status but keep other details visible. Here is an example of how I envision it:

https://i.sstatic.net/MCwzX.png

Below you can find a snippet of sample code that demonstrates the layout:

.accordion {
  border: 1px solid black;
  width: 600px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

.accordion-content {
  flex: 1 1 auto;
}

.epic-summary {
  flex: 1 1 auto;
}

.timeline-bar {
  border-right: 1px solid black;
  display: flex;
  align-items: center;
}

.timeline-bar>div {
  padding: 0 5px;
}
<div class="accordion">
  <div class="accordion-content">
    <div class="timeline-bar">
      <div>JIRA-1234</div>
      <div><img alt="Url  Icon" width="25" src="https://cdn.iconscout.com/icon/premium/png-256-thumb/url-17-695478.png?f=webp&amp;w=256" srcset="https://cdn.iconscout.com/icon/premium/png-256-thumb/url-17-695478.png?f=webp&amp;w=256 1x, https://cdn.iconscout.com/icon/premium/png-256-thumb/url-17-695478.png?f=webp&amp;w=512 2x"></div>
      <div class="epic-summary">EPIC: This is some description</div>
      <div>In progress</div>
    </div>
  </div>
  <div className="accordion-toggle">
    <img src="   https://cdn-icons-png.flaticon.com/512/2985/2985150.png " width="25" height="25">
  </div>
</div>

If you have any suggestions on how to achieve this desired result, please let me know!

Answer №1

Implement min-width or overflow to ensure the elements can shrink accordingly.

.accordion {
  border: 1px solid black;
  width: min(600px, 100%);
  display: flex;
  align-items: center;
}

.accordion-content {
  flex: auto;
  white-space: nowrap;
  overflow: hidden;
}

.timeline-bar {
  border-right: 1px solid black;
  display: flex;
  align-items: center;
}

.timeline-bar>div {
  padding: 0 5px;
  flex: none;
}

.timeline-bar>.epic-summary{
  flex: auto;
  min-width: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
}
<div class="accordion">
  <div class="accordion-content">
    <div class="timeline-bar">
      <div>JIRA-1234</div>
      <div><img alt="Url Icon" width="25" src="https://cdn.iconscout.com/icon/premium/png-256-thumb/url-17-695478.png?f=webp&amp;w=256" srcset="https://cdn.iconscout.com/icon/premium/png-256-thumb/url-17-695478.png?f=webp&amp;w=256 1x, https://cdn.iconscout.com/icon/premium/png-256-thumb/url-17-695478.png?f=webp&amp;w=512 2x"></div>
      <div class="epic-summary">EPIC: Contains some description</div>
      <div>In progress</div>
    </div>
  </div>
  <div className="accordion-toggle">
    <img src="   https://cdn-icons-png.flaticon.com/512/2985/2985150.png " width="25" height="25">
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a concept in JavaScript that includes a data structure called a "matrix" with elements arranged in a grid-like format accessed by

I'm not familiar with the terminology, but I'd like to simplify it: var topicList1 =['hello','hallo', ..., 'hej']; var topicList2 =['a','b',...,'c']; ... var topicList999 =['x,&apo ...

Adjust the size of H1, H2... tags based on their own specifications, rather than the surrounding element

I have run into a bit of a conundrum with my code and cannot seem to find the right solution. Here is what I currently have: <div id="bloquetexto4" class="bloquetexto"> <H2><b>TITULO</b></H2> <p>Texto bla bla bla.</p ...

How does the React rendering model differ from traditional native toolkits?

My curiosity lies in the rendering model, particularly in how React only rerenders elements that have changed. I wonder if native toolkits like GTK and QT follow a similar approach or if they have a different method. Can you shed some light on this? ...

Attempting to create distinct match matchups for every team in a manner reminiscent of the Swiss system format used in the 2024/25 UEFA Champion League

I've been working on devising a tournament pairing system modeled after the updated UEFA Champion League structure. The league phase involves 36 teams, categorized into 4 different pots. Each team is scheduled to play a total of 8 matches against 2 op ...

Parse the HTML document using an HTTP request to access the Document Object Model (DOM)

I am facing an issue with accessing elements of an HTML page through JavaScript. I have tried different methods, but I keep getting the error message: CORS header "Access-Control-Allow-Origin" missing. Here is the code snippet I tried: <!DOCTYPE html&g ...

Can the conventional HTML context menu be swapped out for a link context menu instead?

Currently, I am working on developing a custom linkbox component that is similar to the one found on this page: Here is an example of the code: export const Linkbox = ({}) => { const linkRef = useRef(null); return ( // eslint-disable-next-l ...

Prevent Page Refresh with F5 in Silverlight

Many of the users on my platform are accidentally hitting the F5 key while typing, causing them to lose all their work. I don't want to completely block the ability to refresh the page. I attempted using the following JavaScript solution, however it ...

Transform the assurance into a JSON entity

Currently facing an issue with converting the promise returned by the service to the controller. My goal is to generate an array of JSON objects using the data within the promise. In the controller, this is what I'm receiving: https://i.stack.imgur.co ...

The button in the flex container is not wide enough due to center alignment

For my project, I implemented a CSS grid layout consisting of 20 rows and 20 columns (5% of screen for each cell). One particular page includes a button that initially fit within grid columns 5-8 and rows 6-9 without any issues. However, I wanted to center ...

The email address '[email protected]' is not found in this database

Attempting to execute npm install for a react js project is resulting in the following error message. Error: E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/login-history-api-fallback - Not found npm ERR! 404 npm ERR! 404 '<a href="/ ...

Properly aligning text with checkboxes using HTML/CSS and tags like <span> or <div>

My goal is to have the text displayed as a block in alignment with the checkbox, adjusting based on the sidebar's width. For reference: Current Layout Preferred Layout I have shared the code on CodePen (taking into account screen resolution and wi ...

What steps should I take to resolve the hydration error occurring in the first div of a blank "hello world" webpage

Currently, I am diving into learning Next.js (version 13/14) and have been following some tutorials on YouTube. However, I encountered an issue with my first page when the root HTML element is a <div>. These tutorials are utilizing <div id="root"& ...

What is the best way to design a dynamic menu using HTML, CSS, and jQuery, where each li element gradually disappears?

Consider this menu structure: <ul class="main-menu"> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> </ul> My task is to dynamically hide th ...

The grid feature in the Bones theme is malfunctioning and causing issues

I am currently using the Bones theme from Themble, which has a grid system in its design. I attempted to apply this grid system to the header of my website in order to transform menu items into icons on mobile devices and display the full menu on desktop s ...

How can I position the hyperlink inline with the font-awesome Icon?

Hey everyone, I'm having some trouble creating a top info bar in Bootstrap 4.1.3 with Font-awesome 5.5. I want to include essential details like phone number, email address, and social icons, but whenever I try to add a hyperlink after the icon, it dr ...

Struggling to manage texbox with Reactjs

Currently working in Reactjs with Nextjs and encountering a problem with the "text box". When I use the "value" attribute in the textbox, I am unable to input anything, but when I use the "defaultValue" attribute, I receive a validation message saying "Ple ...

How can I access and retrieve a local variable using geolocation in HTML5 and the Google Maps API?

Seeking assistance with a coding dilemma: I need to retrieve the geolocation position for use in my calcRoute function. The goal is to set the geolocation as the starting point. Below is the code snippet: function calcRoute(){ var pos; navigator.g ...

Altering the background colour of dropdown fields when clicking on a checkbox

How can I make the colors of my dropdown fields match the colors of the text (non-dropdown) fields when they are disabled using a checkbox? This is how my code looks: <form v-on:submit.prevent :disabled="isDisabled(opti ...

Include content within the navigation bar of Bootstrap 3.3

I am trying to insert text at the end of the header in a jumbotron template: <div id="navbar" class="navbar-collapse collapse"> <form class="navbar-form navbar-right"> <div class="form-group"> <input type="text ...

Tips for successfully passing the dynamic state and setState to a function in typescript

I'm encountering an issue with passing dynamic state and setState into a function using Typescript. Despite trying to use Generics, I am facing complaints from Typescript. Here is the code snippet: const handleSelectTag = (tag: { color: string; labe ...