React and Bulma CSS - Not being able to animate modal - css

I am trying to implement fade-in scale effect in a Bulma CSS modal component with react and scss. It opens (gets active) when I click on a button which turns a state variable this.state.open to true as shown in the code below.
<div
className={
this.state.open
? (this.props.modalClass || 'login-modal') + ' modal is-mobile is-active'
: ' modal is-mobile'
}
id={this.props.modalId || 'login-modal'}
>
<div className={`modal-background ${this.state.open && 'modal-bg-active' }`}></div>
<div className={`modal-content ${this.state.open && 'modal-content-active'}`}>
<div ref={node => (this.wrapperRef = node)} className='modal-content-inner columns is-multiline'>
<div className='column left-content'></div>
<div className='column right-content'>
<div className='text-container'>
<div className='text-inner-container'>
.
.
.
.
I didn't add the entire markup here as in most websites I have seen the classes used for animating are modal,modal-background, and modal-content
The sass code I have written for the modal is:
.modal.login-modal {
z-index: 1000;
.modal-background {
transition: all 3s;
opacity: 0;
}
.modal-content {
background: #fff;
max-width: 840px;
width: 100%;
transform: scale(0.7);
opacity: 0;
transition: all 3s;
}
&.is-active {
visibility: visible;
.modal-background {
opacity: 1;
#include box_shadow_dark();
background-color: rgba(0, 0, 0, 0.85);
}
.modal-content {
transform: scale(1);
opacity: 1;
}
}
// .modal-background.modal-bg-active {
// visibility: visible;
// opacity: 1;
// #include box_shadow_dark();
// background-color: rgba(0, 0, 0, 0.85);
// }
// .modal-content {
// background: #fff;
// max-width: 840px;
// width: 100%;
// transform: scale(0.7);
// opacity: 0;
// transition: all 0.3s;
// }
// .modal-content.modal-content-active {
// transform: scale(1);
// opacity: 1;
// }
//==================================================> EXTRA CODE FOR CONTENT INSIDE MODAL
.left-content {
background-color: #fff;
background-image: url('https:some_url');
#include tablet_only {
display: none;
background-image: none;
}
#include mobile_only {
display: none;
background-image: none;
}
}
.right-content {
background: #fff;
.text-container {
text-align: center;
box-sizing: border-box;
#include mobile_only {
padding: 0;
}
}
.text-inner-container {
padding: 40px;
#include mobile_only {
padding: 30px;
height: auto;
}
}
}
// ==================================== Prompt
.prompt-text {
margin: 15px auto 25px;
font-size: 18px;
text-align: left;
}
// ===================================== Email OTP Fields
.user-input-field {
input {
font-size: 14px;
padding: 12px 15px;
width: 100%;
height: auto;
border-width: 2px;
}
label {
font-size: 13px;
text-align: left;
margin-bottom: 10px;
font-weight: $fontWeightBold;
}
.error-message {
font-size: 13px;
color: red;
text-align: left;
margin: 8px 0px 5px;
font-weight: $fontWeightBold;
}
}
.otp-button {
margin: 15px auto 20px;
padding: 11px 15px;
}
// ====================================== Login Buttons
.login-button {
border-radius: 4px;
padding: 13px 15px;
width: 100%;
font-size: 15px;
cursor: pointer;
height: auto;
font-weight: $fontWeightExtraBold;
#include box_shadow_dark();
}
.facebook-login-js {
display: inline-block;
color: white;
margin: 20px auto 15px;
background-color: $fbBlue;
border: none;
&:hover {
background-color: $fbBlueDark;
}
}
// google login
.google-login-js {
display: inline-block;
color: white;
margin: 0px auto 15px;
background-color: $gplusRed;
border: none;
&:hover {
background-color: $gplusRedDark;
}
}
// ========================================== Seperator
.seperator-text-container {
.seperator-text {
font-weight: $fontWeightBold;
color: #555555;
}
}
.terms-line {
font-size: 10px;
}
//=========================================================> EXTRA CODE FOR CONTENT INSIDE MODAL
}
}
What am I getting wrong here? How should I change the code for it to work? I will surely provide more details if required to understand it. Thank you!

I believe the issue is that bulma modal class has display: none property which can not be animated. Try overwriting it to display: block.
Or you could possibly use something like this https://github.com/postare/bulma-modal-fx

Related

Why is my mobile nav menu drawer pushing the site view downwards when it is opened?

Building a mock website for a family member (placeholder photos). When I open the navigation menu, it pushes the screen down instead of simply opening to the right. Seems to translate the view vertically. How can I get it to just open smoothly to the right without pushing the screen view down?
1a) Screen before opening https://i.stack.imgur.com/UfuZi.png
1b) screen when I click nav menu https://i.stack.imgur.com/yfzS3.png
1c) screen when I scroll up after opening the nav menu https://i.stack.imgur.com/9cI5i.png
Here is the css for the navbar:
NAV HEADER CSS
#media only screen and (max-width: 768px) {
body .site-nav__thumb-menu {
position: absolute;
top: 20px;
bottom: unset;
left: unset;
right: unset;
padding-top: 6px;
}
.site-nav__thumb-menu span.icon-menu-label {
display: none;
}
.site-nav__thumb-menu button svg {
color: #000;
box-shadow: none !important;
}
.site-nav__thumb-menu--inactive {
transform: unset;
}
.slide-nav__wrapper {
transform: translateX(-100%) !important ;
background-color: #fff;
}
.slide-nav__dropdown .slide-nav__sublist-header {
text-decoration: none;
}
.slide-nav__overflow--thumb {
width: 100%;
background-color: #000;
height: 100%;
}
.js-menu--is-open .slide-nav__wrapper {
transform: translateX(0) !important ;
}
.site-nav__thumb-menu button {
background-color: unset !important;
padding: 0;
text-align: left;
width: auto;
min-width: auto;
box-shadow: none !important;
}
nav.slide-nav__wrapper .slide-nav {
padding-bottom: 15px;
}
.slide-nav__overflow--thumb {
left: 0;
right: 0;
bottom: unset;
top: 100px;
position: absolute;
max-height: unset;
}
.header-item.mobile-ac.header-item--icons {
flex: unset;
position: absolute;
right: 10px;
top: 8px;
}
header.site-header.small--hide {
display: block !important;
}
.header-wrapper.header-wrapper--overlay {
transition: .5s ease;
}
.header-wrapper.header-wrapper--overlay.sticky {
position: fixed;
width: 100%;
background-color: #fff;
z-index: 99;
}
.header-wrapper.header-wrapper--overlay.sticky .announcement {
display: none;
}
body .header-wrapper--overlay.sticky + .site-nav__thumb-menu {
position: fixed;
top: -18px;
z-index: 9999;
}
.slide-nav a, .slide-nav button {
color: #000;
text-align: left;
z-index: 9999 !important;
}
.slide-nav .search-modal__wrapper {
border: unset;
}
.slide-nav .search-modal__wrapper {
border: unset;
background: #f1f1f1;
padding: 5px 15px;
}
.search-mobc {
padding: 8px 16px;
display: none;
}
nav.slide-nav__wrapper .slide-nav form button {
float: right;
}
nav.slide-nav__wrapper .slide-nav form button svg {
width: 25px;
height: 40px;
}
.slide-nav__overflow {
transition: .5s ease;
}
.slide-nav__overflow--thumb.sticky {
top: 70px;
position: fixed;
z-index: 9999;
}
.slide-nav__link, .slide-nav__sublist-link {
padding: 16px 20px;
}
.slide-nav__overflow--thumb nav.slide-nav__wrapper {
width: 303px;
height: 100%;
overflow-y: auto;
}
.slide-nav a, .slide-nav button {
color: #000 !important;
}
.slide-nav__overflow--thumb .slide-nav__dropdown {
background-color: #fff;
}
.slide-nav__overflow--thumb.js-menu--is-open {
background-color: #000;
height: 100% !important;
}
.slide-nav__wrapper .slide-nav__item {
border-bottom: 1px solid #ccc;
padding: 7px 0;
}
.site-nav__thumb-menu .site-nav__thumb-cart {
display: none;
}
.account-links-m a.slide-nav__link {
border: 2px solid #000;
width: 140px;;
margin: 0 auto;
font-size: 16px;
font-family: Titling !important;
text-transform: uppercase;
display: none;
}
'Slide out menu css'
.slide-nav__overflow--thumb nav.slide-nav__wrapper {
width: 303px;
height: 100%;
overflow-y: auto;
}
.slide-nav a, .slide-nav button {
color: #000 !important;
}
.slide-nav__overflow--thumb .slide-nav__dropdown {
background-color: #fff;
}
.slide-nav__overflow--thumb.js-menu--is-open {
background-color: #000;
height: 100% !important;
}
.slide-nav__wrapper .slide-nav__item {
border-bottom: 1px solid #ccc;
padding: 7px 0;
}
There are several methods to achieve such a thing. I would recommend to remove. the top attribute which would resolve your problem.
What you are doing is :
and what you want is :
Ensuring both your top menu and your floating menu are top:0; should do the work.

Button not laid out against top of relatively positioned container in Firefox

I'm building a toggle switch and the head (button) isn't positioned all the way to the top as I'd expect it to be in Firefox. Works fine in Chrome, so maybe has something to do with default browser styles?
Edit: I know how to make it work, I want to know why it happens.
codepen https://codepen.io/warhammered_cat/pen/qBZYZVy
const toggleSwitch = document.querySelector('.toggle-switch')
const toggleSwitchHead = document.querySelector('.head')
function handleToggle(e) {
toggleSwitch.classList.toggle('active')
}
toggleSwitchHead.addEventListener('click', handleToggle)
* {
box-sizing: border-box;
}
document, body {
margin: 0;
padding: 0;
}
.head {
width: 1.25rem;
height: 1.25rem;
border: 0.125rem solid gray;
border-radius: 50%;
background-color: white;
cursor: pointer;
transition: all 0.4s;
outline: none;
box-shadow: none;
}
.rail {
height: 0.75rem;
width: 100%;
background-color: gray;
border: 0.125rem solid gray;
position: absolute;
top: 0.25rem;
z-index: -1;
border-radius: 0.3rem;
transition: all 0.4s;
}
.toggle-switch {
position: relative;
height: 1.25rem;
width: 2rem;
}
.toggle-switch.active > .head {
background-color: #F7941E;
border-color: #F7841E;
transform: translateX(1rem);
}
.toggle-switch.active > .rail {
border: 0.125rem solid #F7941E;
background-color: white;
}
<div class='toggle-switch'>
<button class='head'></button>
<div class='rail'></div>
</div>
The <button> element is what is specifically being rendered differently in Firefox and Chrome.
If you change the <button> to a <div> the problem fixes itself.
The reason is that the button element is not a block element by default. You have to explicitly set the button to be a block element to get the desired behavior.
.head {
...
display: block;
...
}
try this instead,
Add display:inline-flex; to head class
.head{
display:inline-flex;
}
Click below to see codepen demo
Result :
const toggleSwitch = document.querySelector('.toggle-switch')
const toggleSwitchHead = document.querySelector('.head')
function handleToggle(e) {
toggleSwitch.classList.toggle('active')
}
toggleSwitchHead.addEventListener('click', handleToggle)
* {
box-sizing: border-box;
}
document, body {
margin: 0;
padding: 0;
}
.head {
width: 1.25rem;
height: 1.25rem;
border: 0.125rem solid gray;
border-radius: 50%;
background-color: white;
cursor: pointer;
transition: all 0.4s;
outline: none;
box-shadow: none;
display:inline-flex;
}
.rail {
height: 0.75rem;
width: 100%;
background-color: gray;
border: 0.125rem solid gray;
position: absolute;
top: 0.25rem;
z-index: -1;
border-radius: 0.3rem;
transition: all 0.4s;
}
.toggle-switch {
position: relative;
height: 1.25rem;
width: 2rem;
}
.toggle-switch.active > .head {
background-color: #F7941E;
border-color: #F7841E;
transform: translateX(1rem);
}
.toggle-switch.active > .rail {
border: 0.125rem solid #F7941E;
background-color: white;
}
<div class='toggle-switch'>
<button class='head'></button>
<div class='rail'></div>
</div>

Bootstrap 4.1 floating labels

I've found on Google a doc example for Bootstrap 4.1 in which they feature floating labels: getbootstrap.com/docs/4.1/examples/floating-labels/
In that page, however, it is not explained how that can be achieved, and I can't find anything in the docs for v. 4.1. Floating labels are not even listed as a new feature in the ship list.
Does anyone know if floating labels are supported?
It says on the Bootstrap examples page that floating-labels are...
"Experiments - Examples that focus on future-friendly features or
techniques."
Like many of the other examples, there's an additional CSS file used in the example...
Using the floating-labels.css they work as expected in the supported browsers...
https://www.codeply.com/go/X9VbHqzD4B
Best way for me is using transform translate. It is smoother. I have added extra classes to prevent overwriting bootstraps original classes.
body{padding:75px}
.form-group.floating>label {
bottom: 34px;
left: 8px;
position: relative;
background-color: white;
padding: 0px 5px 0px 5px;
font-size: 1.1em;
transition: 0.1s;
pointer-events: none;
font-weight: 500 !important;
transform-origin: bottom left;
}
.form-control.floating:focus~label{
transform: translate(1px,-85%) scale(0.80);
opacity: .8;
color: #005ebf;
}
.form-control.floating:valid~label{
transform-origin: bottom left;
transform: translate(1px,-85%) scale(0.80);
opacity: .8;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="form-group floating">
<input type="text" class="form-control floating" id="usr" required value="">
<label for="usr">Username</label>
</div>
Styles they ware using in that mentioned example site
:root {
--input-padding-x: .75rem;
--input-padding-y: .75rem;
}
html,
body {
height: 100%;
}
body {
display: -ms-flexbox;
display: -webkit-box;
display: flex;
-ms-flex-align: center;
-ms-flex-pack: center;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: center;
justify-content: center;
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
}
.form-signin {
width: 100%;
max-width: 420px;
padding: 15px;
margin: 0 auto;
}
.form-label-group {
position: relative;
margin-bottom: 1rem;
}
.form-label-group > input,
.form-label-group > label {
padding: var(--input-padding-y) var(--input-padding-x);
}
.form-label-group > label {
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
margin-bottom: 0; /* Override default `<label>` margin */
line-height: 1.5;
color: #495057;
border: 1px solid transparent;
border-radius: .25rem;
transition: all .1s ease-in-out;
}
.form-label-group input::-webkit-input-placeholder {
color: transparent;
}
.form-label-group input:-ms-input-placeholder {
color: transparent;
}
.form-label-group input::-ms-input-placeholder {
color: transparent;
}
.form-label-group input::-moz-placeholder {
color: transparent;
}
.form-label-group input::placeholder {
color: transparent;
}
.form-label-group input:not(:placeholder-shown) {
padding-top: calc(var(--input-padding-y) + var(--input-padding-y) * (2 / 3));
padding-bottom: calc(var(--input-padding-y) / 3);
}
.form-label-group input:not(:placeholder-shown) ~ label {
padding-top: calc(var(--input-padding-y) / 3);
padding-bottom: calc(var(--input-padding-y) / 3);
font-size: 12px;
color: #777;
}
If you really want floating label, see this awesome Bootstrap 4 theme : http://djibe.github.io/material/docs/4.4/material/text-fields/
SCSS version below including support for textarea and excluding styles from IE11, which doesn't support :placeholder-shown.
:root {
--input-padding-x: .75rem;
--input-padding-y: .75rem;
}
.floating-label {
$placeholderColour: $middleGrey;
position: relative;
input, textarea, label {
padding: var(--input-padding-y) var(--input-padding-x);
}
label {
position: absolute;
top: 0;
left: 0;
display: block;
margin-bottom: 0;
line-height: 1.5;
color: $placeholderColour;
border: 1px solid transparent;
border-radius: .25rem;
transition: all .1s ease-in-out;
&:hover {
cursor: text;
}
}
input::-webkit-input-placeholder {
color: transparent;
}
input:-ms-input-placeholder {
color: transparent;
}
input::-ms-input-placeholder {
color: transparent;
}
input::-moz-placeholder {
color: transparent;
}
input::placeholder {
color: transparent;
}
textarea::-webkit-input-placeholder {
color: transparent;
}
textarea:-moz-placeholder {
color: transparent;
}
textarea::-moz-placeholder {
color: transparent;
}
textarea:-ms-input-placeholder {
color: transparent;
}
textarea::placeholder {
color: transparent;
}
input:not(:placeholder-shown),
textarea:not(:placeholder-shown) {
padding-top: calc(var(--input-padding-y) + var(--input-padding-y) * (2 / 3));
padding-bottom: calc(var(--input-padding-y) / 3);
}
input:not(:placeholder-shown) ~ label,
textarea:not(:placeholder-shown) ~ label {
padding-top: calc(var(--input-padding-y) / 3);
padding-bottom: calc(var(--input-padding-y) / 3);
font-size: 12px;
&:hover {
cursor: default;
}
}
#media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
label {
display: none;
}
textarea:-ms-input-placeholder, input:-ms-input-placeholder {
color: $placeholderColour;
}
textarea::-ms-input-placeholder, input::-ms-input-placeholder {
color: $placeholderColour;
}
}
}
I've created an input floating label for Bootstrap 4 & 5 (not the same look that Bootstrap provides): https://github.com/tkrotoff/bootstrap-floating-label
Here is the online demo: https://codesandbox.io/s/github/tkrotoff/bootstrap-floating-label/tree/codesandbox.io

Unwanted Text Shadow Displaying Text Pre-Hover

I have a feed-reader that displays text on hover. Before hovering, some text shadow is present, making the word shadow visible.
http://codepen.io/Teeke/pen/JWqpoP
a{
color: inherit;
text-decoration: none;
}
I've tried changing line 109 in the CSS from
'color: inherit'
to transparent, or rgba(0,0,0,0), but that will make all the text disappear.
How can I fix this CSS conflict?
So, basically what you need to do is originally set the text shadow's color to transparent. Then, when it is hovered over, you can change the text shadow's color to whatever you want. Here's an example of what this effect looks like on text that's already visible:
h1 {
color: red;
text-shadow: 1px 1px 3px transparent;
}
h1:hover {
text-shadow: 1px 1px 3px #333;
}
<h1>Hello world</h1>
Hope that helps!
It looks like making this change to the SCSS code:
&:hover{
.bar, .overlay{
transform: translateY(0);
color: inherit;
text-shadow: 2px 2px 2px #222;
}
and removing the text-shadow from the .item selector also works.
You don't want to change your font to transparent to fade an element like that. Besides just being a bad practice and pain in the butt to work with, it isn't performant. Just fade the entire .bar and .overlay from opacity: 0 to opacity: 1 on hover
var Settings = {
subreddit : 'PositiveTechnology',
after: 'o',
limit: 25
}
let d = new Date; document.getElementById("date").innerHTML = d.toUTCString();;
let $grid = $('#positive-technology')
.attr('data-loading-text','')
.packery({ itemSelector: '.item' })
.on('click','.overlay', function(){
$(this).parent().toggleClass('active').parent().packery('layout');
});
function RedditJSON(){
this.loadLink = function(){
Settings.isLoading = true;
return 'https://www.reddit.com/r/' + Settings.subreddit + '/.json?after=' + Settings.after + '&limit=' + Settings.limit;
}
this.next = function(feed){
if (Settings.theLast) return;
if (feed.data.after == null) Settings.theLast = true;
let posts = feed.data.children;
for(let i = 0; i < posts.length; i++){
if(true){ // posts[i].data.post_hint == 'image' || posts[i].data.url.search('imgur')
if(!posts[i].data.hasOwnProperty('preview')) continue;
let image = posts[i].data.preview.images[0];
let permalink = 'https://reddit.com' + posts[i].data.permalink;
let elem = $('<div>').addClass('item').css('background-image', 'url(' + image.source.url + ')');
let overlay = $('<a>').addClass('overlay').appendTo(elem);
let bar = $('<div>').addClass('bar').appendTo(elem);
let link = $('<a>').addClass('post').attr({target: '_blank', href: permalink}).appendTo(bar).text(posts[i].data.title);
let zoom = $('<a>').addClass('zoom').attr({target: '_blank', href: image.source.url}).appendTo(bar).html('<i class="fa fa-camera-retro"></i>');
if (posts[i].data.stickied){
elem.addClass('stickied');
}
// if (image.source.width > image.source.height){
// elem.addClass('wide');
// }
// if(posts[i].data.created % 6 == 0){
// elem.addClass('active');
// }
$grid.append(elem).packery('appended', elem).packery('layout');
}
}
Settings.after = feed.data.after;
Settings.isLoading = false;
}
}
var bob = new RedditJSON();
function loadNext(){
if (Settings.isLoading){
setTimeout(loadNext,100);
return;
} else {
$.getJSON(bob.loadLink(), bob.next);
}
}
$(function() {
// return;
loadNext();
$(window).scroll(function () {
console.log($(window).scrollTop() + ' ' + ($('body').height() - $(window).height() - 10));
if ($(window).scrollTop() >= $('body').height() - $(window).height() - 10 && !Settings.isLoading) {
loadNext();
}
});
});
/* https://designshack.net/articles/css/12-fun-css-text-shadows-you-can-copy-and-paste/ */
#import url("http://fonts.googleapis.com/css?family=Raleway:200,300, 800");
* {
box-sizing: border-box;
}
body {
margin-top: 100px;
padding: 0;
background: #181818;
font-family: 'Raleway', sans-serif;
color: rgba(250, 250, 250, 0.8);
background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/577362/pexels-photo%20(4).jpg");
background-size: 100% 90%;
background-repeat: no-repeat;
text-shadow: 2px 2px 2px rgba(100, 100, 120, 0.8);
}
.base-title {
font-weight: 200;
font-size: 85px;
/* ORIG 70px */
}
h1 {
text-align: center;
font-weight: lighter;
}
h4 {
text-align: center;
font-weight: 300;
margin-top: -10%;
font-size: 20px;
}
#date {
text-align: center;
margin-bottom: 10%;
}
.ticker {
margin-top: 7%;
}
.grid {
width: 100%;
max-width: 1200px;
margin: auto;
position: relative;
}
.grid::after {
display: block;
content: attr(data-loading-text);
text-align: center;
width: 100%;
padding: 20px 0;
position: absolute;
top: 100%;
}
.grid .item {
position: relative;
display: block;
width: 200px;
height: 200px;
background-size: cover;
background-position: center center;
cursor: pointer;
overflow: hidden;
color: white;
text-align: center;
padding: 5px;
border-radius: 2px;
margin-left: 30px;
margin-bottom: 30px;
box-shadow: inset 0 0 10px #000000;
-webkit-filter: saturate(1.5) contrast(107%);
text-shadow: 2px 2px 2px #222;
}
.grid .item.wide {
width: 25%;
}
.grid .item.active {
width: 25%;
height: 600px;
}
.grid .item.wide.active {
width: 100%;
height: 650px;
}
.grid .item .bar {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
padding: 0 4px;
z-index: 4;
color: white;
}
.grid .item .bar a {
text-decoration: none;
font-size: 22px;
font-weight: bold;
}
.grid .item .bar a.zoom {
float: right;
}
.grid .item .overlay {
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(to top, #001, transparent 100px);
z-index: 3;
}
.grid .item .bar, .grid .item .overlay {
transition: transform 250ms, opacity 250ms;
transform: translateY(80px);
opacity: 0;
}
.grid .item:hover .bar, .grid .item:hover .overlay {
transform: translateY(0);
opacity: 1;
}
.grid .item.stickied .overlay {
background: linear-gradient(to top, #0f0, transparent 80px);
}
#media (max-width: 520px) {
.grid .item {
width: 100% !important;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://unpkg.com/packery#2/dist/packery.pkgd.js"></script>
<h1 class="base-title">Positive Technology</h1>
<!-- <h4>Useful News</h4> -->
<h1 class="ticker"> · Hydroponics · Aeroponics · Micro-solar · Micro-wind · 3D-Printing · Eco-Houses · Water Filtration ·</h1>
<div class="grid" id="positive-technology"></div>
<h2 id="date"></h2>
I got some interesting tips from everybody's answers here, but I went the easiest route. I had some code in the body section of the CSS:
text-shadow: 2px 2px 2px rgba(100,100,120,0.8);
affecting all the text throughout the page. I removed it from body and inserted it into each individual selector as needed.

Ionic 2 overriding sass items

I have an Ionic 2 app, that has an ion-searchbar.
<div id="search" class="search-input-keyword">
<ion-searchbar class="ion-searchtext" id="ion-searchtext" [(ngModel)]="searchQueryText" (ionFocus)="focusSearch($event)"
(change)="onChangeText($event)" (ionClear)="onCancelText($event)" (ionInput)="onInputText($event)" placeholder="{{jobType === 0 ? favourite ? 'Market Favourites' : 'Market' : favourite ? 'Postings Favourites' : 'Postings'}}"
debounce="1"></ion-searchbar>
</div>
I would like to change the input text color, and the magnifying glass icon color to #fff.
I have read here, that in order to do so, you need to change the sass variables.
I have tried the following in variables.scss:
$colors: (
primary: #009196,
secondary: #32db64,
danger: #f53d3d,
light: #f4f4f4,
dark: #222
);
$searchbar-ios-input-text-color: #fff;
$searchbar-ios-input-search-icon-color: #fff;
But there is no effect.
However, the following line does have an effect:
$text-color: #000099;
So I guess that the $searchbar-ios-input-text-color: #fff; and $searchbar-ios-input-search-icon-color: #fff; are the issue.
Question
Can anyone please advise how to change the font and icon colours?
Thanks
UPDATE
Here is some more code samples:
css
.toolbar-background-md {
background: linear-gradient(to bottom right, #00a7ad, #004547);
}
.bar-button-default-md {
color: #fff;
}
.searchbar-md .searchbar-input {
background: linear-gradient(to bottom right, #009da3, #018287);
//background-color: #009196;
}
input::-webkit-input-placeholder {
color: red ;
}
input:-moz-placeholder {
color: red ;
}
input:-ms-input-placeholder { /* IE10+ */
color: red ;
}
.toolbar-title-md {
padding: 0 12px;
font-size: 2rem;
font-weight: 500;
color: #fff;
}
.close-filters {
color: #fff;
width: 52px;
font-size: 22px;
background-color: transparent;
box-shadow: none !important;
}
.slide-fade-hide {
transition: 1s all linear;
opacity: 0;
height: 0;
position: absolute;
top: 0;
z-index: -10;
}
.slide-fade-show {
transition: all 1.2s ease-in;
opacity: 1;
height: 2em;
z-index: 1;
}
.list-md {
margin: 0px 0px 0px 0;
}
.scroll-up {
margin-top: 20px;
}
.menu-title {
padding: 1px 95px 1px 10px;
}
.menu-toolbar {
padding: 35px;
}
.menu-content {
position: relative !important;
}
.item-search-wanted {
padding-left: 1px;
}
.item-search-offered {
padding-left: 1px;
}
.job-content-offered {
background-color: white !important;
}
.job-content-wanted {
background-color: white !important;
}
.search-button-star {
background-color: #009196;
}
.search-input-keyword {
width: 125%;
display: flex;
}
.search-input {
width: 125%;
}
.toolbar-content {
display: flex;
}
.extra-search-col {
padding: 0px;
}
ion-col {
padding: 2px;
}
ion-title {
z-index: 11;
}
ion-avatar img {
border-radius: 2.8rem;
max-height: 5.6rem;
max-width: 5.6rem;
}
.small-text-search {
font-size: 75% !important;
color: grey !important;
padding-top: 4px;
}
.small-text-search-desc {
font-size: 85%;
}
.small-text-search-rating {
padding-top: inherit;
padding-left: inherit;
}
.small-text-search-starrating {
padding-top: 2px;
font-size: 100% ! important;
}
.search-category {
float: right;
}
.job-tite {
width: 250px;
}
.job-timestamp {
white-space: nowrap;
}
.search-rating {
float: left;
}
.search-popover-button {
width: 75px;
height: 75px;
}
.button-icon-only ion-icon.search-popover-icon {
font-size: 2.8em;
}
.filter-image {
-webkit-filter : hue-rotate(-30deg) opacity(100%);
filter : hue-rotate(-30deg) opacity(100%);
}
.icon-text {
padding-left: 5px;
padding-bottom: 3px;
}
.icon-text-no {
padding-left: 5px;
}

Resources