File

libs/upp-wdgt/src/components/upp-panel/upp-panel.ts

Description

A versatile panel component with sections for header, content, and footer.

This component is designed to structure content into a panel layout, supporting configurable size and border visibility. The upp-panel serves as the container, while the upp-panel-header, upp-panel-content, and upp-panel-footer components define distinct regions within the panel.

Features

  • Configurable panel size (small or large).
  • Option to show or hide the border.
  • Fully customizable content using Angular's ng-content for dynamic projection.

Usage

Example :
<upp-panel size="large" border="show">
  <upp-panel-header>
    <h1>Panel Header</h1>
  </upp-panel-header>
  <upp-panel-content>
    <p>Main content goes here.</p>
  </upp-panel-content>
  <upp-panel-footer>
    <button>Submit</button>
  </upp-panel-footer>
</upp-panel>

Options

  • Size (size):
    • 'small': Displays the panel with a smaller layout.
    • 'large' (default): Displays the panel with a larger layout.
  • Border (border):
    • 'show' (default): Displays a visible border around the panel.
    • 'hide': Hides the panel border.

Metadata

Index

Inputs
HostBindings
Accessors

Inputs

lines
Type : "show" | "hide"
Default value : 'hide'

Controls whether the panel border is visible. Available options:

  • 'show': The border is visible (default).
  • 'hide': The border is hidden.
size
Type : "small" | "large" | "auto"
Default value : 'auto'

Sets the size of the panel. Available options:

  • 'small': A smaller panel size.
  • 'large': A larger panel size (default).

HostBindings

class
Type : string

Dynamically calculates the CSS classes for the panel based on the size and border inputs.

Accessors

panelClasses
getpanelClasses()

Dynamically calculates the CSS classes for the panel based on the size and border inputs.

Returns : string
<ng-content></ng-content>

./upp-panel.scss

:host {
    --panel-small-max-width: 450px;

    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--ion-background-color);

    margin: 3px;
    height: calc(100% - 6px);
    padding: 0px;

    @media (max-width: var(--panel-small-max-width)){
        min-width: 100% !important; 
    }
    
    /************************************/
    /* HOST BINDINGS                    */
    /************************************/

    &.--border-hide {
        ::ng-deep upp-panel-content {
            border: none;
        }
    }

    &.--auto {
        margin: 0px;
        width: 100%;
    }

    &.--large {
        width: calc(100% - 6px);

        ::ng-deep upp-panel-content {
            width: 100%; 
        }

        &.--border-show {
            border-radius: 8px;
            border: 2px solid var(--ion-color-light);    
            border-top-style: none;
            border-top-left-radius: 0px;
            border-top-right-radius: 0px;    
        }
    }

    &.--small {
        flex: 0 0 var(--panel-small-max-width);
        width: var(--panel-small-max-width);
        max-width: var(--panel-small-max-width);

        transition: max-width linear 0.1s;
        &[hidden] {
            display: block !important;
            margin: 0px !important;
            padding: 0px !important;
            border: none !important;
            max-width: 0px;
        }

        ::ng-deep upp-panel-content {
            width: 100%;
        }

        &.--border-show {
            border-radius: 8px;
            border: 2px solid var(--ion-color-light);    
            border-top-style: none;
            border-top-left-radius: 0px;
            border-top-right-radius: 0px;
        }
    }

    /************************************/
    /* HEADER, CONTENT, FOOTER          */
    /************************************/
        
    ::ng-deep upp-panel-header {
        flex: 0 0 auto;
        background-color: var(--ion-color-warning);
        box-shadow: 0px 2px 4px rgba(var(--ion-color-dark-rgb), 0.2);
    }
    
    ::ng-deep upp-panel-content {
        display: flex;
        overflow: hidden;
        flex: 1 1 auto;
        flex-direction: row;
    }
    
    ::ng-deep upp-panel-footer {
        flex: 0 0 auto;
        background-color: var(--ion-color-warning);
        box-shadow: 0px -2px 4px rgba(var(--ion-color-dark-rgb), 0.2);
    }    
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""