I have this problem.
I have a component calls navbar and it is fix for all app.
<div class="wrapper" fixed>
<nav id="sidebar" [ngClass]="{'active':!navbarOpen}">
<div [ngClass]="{'sidebar-header':navbarOpen,'sidebar-header-active':!navbarOpen}" >
<h3 align="left">CHROMAE PROJECT</h3>
</div>
</nav>
<div id="content" [ngClass]="{'active':!navbarOpen}">
<nav class="navbar navbar-default fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<div>
<button class="btn btn-info navbar-btn" type="button" (click)="myClickEvent()" >
<i class="glyphicon glyphicon-align-left"></i>
<span>MENÚ</span>
</button>
</div>
</div>
<div align="right">
<button class="btn btn-info navbar-btn" align="right" type="button" (click)="logOut()" >
<span>LOGOUT</span>
</button>
</div>
</div>
</nav>
</div>
</div>
So in other component calls home i have this:
<app-navbar>
<div>
<div *ngIf="getIsAdmin()">
hola Admin
</div>
<div *ngIf="getIsModerator()">
hola Admin
</div>
<div *ngIf="getIsUser()">
hola Admin
</div>
</div>
Can i put the "div" with ngIf like that?
<app-navbar>
navbar.div with id = content = {
<div>
<div *ngIf="getIsAdmin()">
hola Admin
</div>
<div *ngIf="getIsModerator()">
hola Admin
</div>
<div *ngIf="getIsUser()">
hola Admin
</div>
</div>
}
Because im trying too add inside navbar div class with id="content" that divs with *ngIf.
I dont know if i can explain my self :D
It looks like you are trying to use something like <ng-content> and content projection. Here is a useful article explaining it a little.
Here is a Stackblitz demoing a very small ng-content example.
For quick reference, in your "parent" component (in your case your nav-bar) you will tell angular where you want nested content to go:
nav-bar.component.html
<div class="wrapper" fixed>
<!-- your nav-bar code -->
<!-- nested content will go here -->
<ng-content></ng-content>
</div>
Then when you use your nav-bar, you can "project" content into that ng-content tag:
app.component.html (or any other component)
<nav-bar>
Here is some content to project into the nav-bar's ng-content
</nav-bar>
See the stackblitz for the full code. There is also a way to have multiple ng-content tags using selectors. The article explains those if you need to have more projected slots.
It looks like you have some complex logic in your nav-bar so I didn't try to reproduce your code. The small demo should get you started in the right direction, though.
You can control the getIsAdmin in the own app-nav
Or you can use <ng-content> in your app-navbar
<div class="wrapper" fixed>
....
<ng-content></ng-content>
</div>
So, in your main.html you can do
<app-navbar>
<div *ngIf="getIsAdmin()">
hola Admin
</div>
...
</app-navbar>
Related
I'm working in an offline view for PWA, I need to design this view (or very similar)
I have tried with this
#extends('layouts.app_site')
#push('styles')
#endpush
#section('content')
<div class="row">
<div class="col-lg-12">
<div class="ibox product-detail">
<div class="ibox-content">
<div class="alert alert-dark" role="alert">
You are currently offline
</div>
<div class="form-group row">
<div class="col-lg-12 text-center">
<img src="{{asset('img/gp_no_image.png')}}">
<h1>
You are currently offline
</h1>
We couldn't load the next page on this connection. Please try again.
</div>
</div>
<div class="form-footer text-center">
<a href=""
class="btn btn-primary btn-sm">Retry Connection</a>
</div>
</div>
</div>
</div>
</div>
#endsection
#push('scripts')
#endpush
And this is my result (ignore the background image)
How can I change the upper alert style like the example image? (use all ibox-content and black color)
and how can I make the retry button bigger?
for alerts, I'm using bootstrap
for buttons, I'm using inspinia
styles
thanks
I am using Bulma as my CSS framework, and while trying to use their modals, they aren't styled at all, as if I'm missing something.
The overlay is there, and x button seems in place and visible, but the content is greyed out.
I am using this code:
<body>
<div id="modal-id" class="modal is-active">
<div class="modal-background"></div>
<div class="modal-content">
Any other Bulma elements you want
</div>
<button class="modal-close is-large" aria-label="close"></button>
</div>
</body>
All other Bulma elements are working.
Note: I am not asking about JS part and how to actually show the modal on click. I am having pure CSS issues.
But this is currently being shown and there is no problem!
if you want a Design, like a card, change .modal-content div to this:
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Modal title</p>
<button class="delete" aria-label="close"></button>
</header>
<section class="modal-card-body">
YOUR CONTENT
</section>
<footer class="modal-card-foot">
<button class="button is-success">Save changes</button>
<button class="button">Cancel</button>
</footer>
</div>
I need to separately collapse accordions created inside a vue js v-for. I know that something like Id which can be used to separately identify the accordion will solve this. But don't know where to give this dynamic id?
Here is my HTML
<div role="tablist">
<div v-for="item in productFormData" v-bind:key="item.id">
<b-card no-body class="mb-1">
<b-card-header header-tag="header" class="p-1" role="tab">
<b-button block v-b-toggle.accordion-productdetails variant="info">Product Details</b-button>
</b-card-header>
<b-collapse
id="accordion-productdetails"
visible
accordion="productdetails-accordion"
role="tabpanel"
>
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
<span style="font-size:13px;font-weight:bold;">Name</span>
<div>
<span id="spnCustomerName">{{item.name}}</span>
</div>
</div>
</div>
</b-collapse>
</b-card>
</div>
To add a dynamic id to it you need to add index to the for loop so every time you use the index to identify the specific accordion like this, or you can use your item.id but i don't know the content of it:
CODEPEN :
https://codepen.io/emkeythekeyem/pen/WNbqeyM?editors=1010
<div role="tablist">
<div v-for="(item,index) in productFormData" v-bind:key="item.id">
<b-card no-body class="mb-1">
<b-card-header header-tag="header" class="p-1" role="tab">
<b-button block v-b-toggle="'accordion-productdetails'+index" variant="info">Product Details</b-button>
</b-card-header>
<b-collapse
:id="'accordion-productdetails'+index"
visible
:accordion="'productdetails-accordion'+index"
role="tabpanel"
>
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
<span style="font-size:13px;font-weight:bold;">Name</span>
<div>
<span id="spnCustomerName">{{item.name}}</span>
</div>
</div>
</div>
</b-collapse>
</b-card>
</div>
see https://bootstrap-vue.js.org/docs/components/collapse/#usage:
<!-- Using value -->
<b-button v-b-toggle="'collapse-2'" class="m-1">Toggle Collapse</b-button>
EDIT :
Reviewing my code i noticed that the accordion param in <b-collapse needs to change also, just edit it to :
:accordion="'productdetails-accordion'+index"
I also edited the code of my first answer
Using Bootstrap 5 with CDN, first import the <link> and JS bundle in the public/index.html.
The code is from the Bootstrap 5 accordion. Notice that the flush-headingOne has been changed to 'flush-heading'+index.
Notice the accordionCollection could be imported from the js file with data(), or passed down from the parent props. The property title, description could be different defined in the array data.
HTML (template)
<div class="accordion accordion-flush" id="accordionFlushExample">
<div class="accoridon-item" v-for="(accordionItem,index) in accordionCollection" :key="index">
<h2 class="accordion-header" :id="'flush-heading'+index">
<button
class="accordion-button collapsed"
type="button"
data-bs-toggle="collapse"
:data-bs-target="'#flush-collapse'+index"
aria-expanded="false"
:aria-controls="'flush-collapse-'+index">
{{ accordionItem.title }}
</button>
</h2>
<div
:id="'flush-collapse'+index"
class="accordion-collapse collapse"
:aria-labelledby="'flush-heading'+index"
data-bs-parent="#accordionFlushExample">
<div class="accordion-body"> {{ accordionItem.description }} </div>
</div>
</div>
</div>
I'm writing a landing page using bootstrap 4.3.1.
After adding the "row" div, the horizontal ruler disappears and I just can't get it back.
The funny thing is when I'm adding the commented section tag, I can see the horizontal line again.
Any suggestions to why it happens/how to make the horizontal line visible again without the section tag?
<div class="container">
<div class="row">
<header class="text-center">
<h1 class="text-uppercase"><strong>The biggest startup event of the year</strong></h1>
</header>
<!-- <section> -->
<hr>
<button class="btn btn-primary btn-xl">Find out more</button>
<!-- </section> -->
</div>
</div>
what you are trying to do is bit confusing as hr tag gives the horizontal line with width=100% and the row occupy a horizontal row
so think again is this possible, try to close the div of rows and then try to put the hr tag
<div class="container">
<div class="row">
<header class="text-center">
<h1 class="text-uppercase"><strong>The biggest startup event of theyear</strong></h1>
</header>
</div>
<!-- <section> -->
<hr>
<button class="btn btn-primary btn-xl">Find out more</button>
<!-- </section> -->
</div>
I have a navbar inside the tab-content that has pull-right bootstrap class ,we are rendering element js-property-panel based on user selection so when this element loads it is overlapping on navbar. So both are iniside cols 10. How can i set position of navbar using pull-right when js-property-panel loads it should moved to right ?
main.html
<div class="col-md-10" ng-class="{'col-md-12':isCollapsed,'col-md-10':!isCollapsed,'tabContentCollapse-padding':isCollapsed}">
<div class="tab-content">
<nav class="navbar navbar-default pull-right">
<div class="container-fluid">
//navbar stuff here
</div>
<!-- /.container-fluid -->
</nav>
<div role="tabpanel" class="active" id="tab">
<div>
<div id="home" class="fade in active">
<div class="modeler">
<div id="canvas" style="height:80vh;"></div>
<div id="js-properties-panel"></div>
</div>
</div>
</div>
</div>
</div>
</div>
Are you looking for a pure css solution? As this can be achieved with
javascript pretty easily.
Also here is a link of css tricks that might be useful to
introduce conditional styling using css.
Update:
Here is how far I could get to- please follow the fiddle here
<div class="col-md-10" ng-class="{'col-md-12':isCollapsed,'col-md-10':!isCollapsed,'tabContentCollapse-padding':isCollapsed}">
<div class="tab-content row">
<div class="col-md-6 col-md-push-6 navwrapper">
<nav class="navbar navbar-default">
<div class="container-fluid">
//navbar stuff here
</div>
<!-- /.container-fluid -->
</nav>
</div>
<div role="tabpanel" class="col-md-6 col-md-pull-6" id="tab">
<div>
<div id="home" class="fade in active">
<div class="modeler">
<div id="js-properties-panel" class="panel-contents">
sample content
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Observations:
What you are trying to achieve is controlling the style of an element
higher up the DOM tree using a state an element lower down the tree.
Neither those elements are direct parent-child nor are those siblings
so you could control using common class and may be adding a
:not(:empty) selector.
You could still use the column-ordering to a certain extend though