vue - how change style of package v-calendar - css

I'm currently working on a project that contains vuejs and I have a need to develop a datepicker. To do this, I've decided to use the following package v-calendar
I've been able to implement the component and works as expected out-of-the-box, however I'm trying some customization like styles (following the documentation) but it just won't work of some cases, can't figure out why.
The idea is to achieve this:
I've been able to set the header style through setupCalendar, however, when I try to apply the style to the content it won't change.
After searching further in the documentation, I've noticed that they were passing the style as attributes, to which I've tried to replicate without any success.
I also wanted to know, if it's possible to submit the received $attrs that are inherited by the father-component into the input? At the moment I'm passing 1 by 1 using input-props but I'm wondering if theres a better approach.
right now it's like this:
any suggestions?
<template>
<date-picker
:attributes="attributes"
v-model="date"
:input-props="{
id: $attrs.id,
name: $attrs.name,
class: 'input--default color--white',
autocomplete: 'nope',
readonly: true
}"
>
</date-picker>
</template>
<script>
// packages
import { setupCalendar, DatePicker } from 'v-calendar'
import 'v-calendar/lib/v-calendar.min.css';
setupCalendar({
locale: 'pt-PT',
themeStyles: {
wrapper: {
fontSize: '17px',
lineHeight: '21px',
boxShadow: '5px 5px 10px 1px rgba( 0, 0, 0, .10 )',
},
header: {
color: '#f7890b',
textTransform: 'capitalize'
},
weekdays: {
color: '#ededed'
},
},
attributes: [{
contentStyle: {
color: '#ff4d4d', // Red
fontWeight: 600,
fontSize: '10px',
},
popover: { color: 'yellow', },
highlight: {
backgroundColor: 'purple',
},
}]
});
export default {
inheritAttrs: false,
components: {
DatePicker
},
data () {
return {
date: null,
attributes: [{
contentStyle: {
color: '#ff4d4d', // Red
fontWeight: 600,
fontSize: '10px',
},
popover: { color: 'yellow', },
highlight: {
backgroundColor: 'purple',
},
}]
}
}
}
</script>
<style>
</style>

If using vue-datepicker you can change the css style adding this styles to your .css or in your view inside <style> ...</style>
Here an example of the elements, i already use to change the input as bootstrap style
body {
font-family: "Helvetica Neue Light", Helvetica, sans-serif;
padding: 1em 2em 2em;
}
input,
select {
padding: 0.75em 0.5em;
font-size: 100%;
border: 1px solid #ccc;
width: 100%;
}
select {
height: 2.5em;
}
.example {
background: #f2f2f2;
border: 1px solid #ddd;
padding: 0em 1em 1em;
margin-bottom: 2em;
}
code,
pre {
margin: 1em 0;
padding: 1em;
border: 1px solid #bbb;
display: block;
background: #ddd;
border-radius: 3px;
}
.settings {
margin: 2em 0;
border-top: 1px solid #bbb;
background: #eee;
}
h5 {
font-size: 100%;
padding: 0;
}
.form-group {
margin-bottom: 1em;
}
.form-group label {
font-size: 80%;
display: block;
}

Related

How can I use CSS to style the Stripe inputs on a Bigcommerce cart integration?

I am using Stripe as my payment processor on BigCommerce. It works perfectly. The problem is that my site theme has a black background. When you type in your credit card info, the text is black in the Stripe inputs so you can't see it. I've tried to use CSS in both checkout.scss and optimized-checkout.scss to try and overwrite it, but since Stripe is loaded via JS and in what looks to be an iFrame, I can't figure it out.
I've added this css to both and it still doesn't work
input {
color: #eee !important;
}
May be you can use JavaScript for this,
document.getElementById("element_id").style etc...
I did not do that thing earlier, but this solution works on these types of scenarios!
but since Stripe is loaded via JS and in what looks to be an iFrame, I can't figure it out.
Indeed! It doesn't use the styling in your CSS, you have to specify it via Javascript by passing a style object when creating the Element:
https://stripe.com/docs/js/elements_object/create_element?type=card#elements_create-options-style
https://stripe.dev/elements-examples/
If you're not the one writing the code that interacts with stripe.js at this level you probably want to reach out to Bigcommerce or something to ask them to expose access in some way.
var stripe = Stripe('pk_test_6pRNASCoBOKtIshFeQd4XMUh');
var elements = stripe.elements();
var card = elements.create('card', {
style: {
base: {
iconColor: '#666EE8',
color: 'white', // color of the text : https://stripe.com/docs/js/appendix/style
lineHeight: '40px',
fontWeight: 300,
fontFamily: 'Helvetica Neue',
fontSize: '15px',
'::placeholder': {
color: '#CFD7E0',
},
},
}
});
card.mount('#card-element');
* {
font-family: "Helvetica Neue", Helvetica;
font-size: 15px;
font-variant: normal;
padding: 0;
margin: 0;
}
body {
background: #171515;
display: flex;
align-items: center;
justify-content: center;
min-height: 100%;
}
form {
width: 480px;
margin: 20px 0;
}
.group {
box-shadow: 0 7px 14px 0 rgba(49,49,93,0.10),
0 3px 6px 0 rgba(0,0,0,0.08);
border-radius: 4px;
margin-bottom: 20px;
}
label {
position: relative;
color: #8898AA;
font-weight: 300;
height: 40px;
line-height: 40px;
margin-left: 20px;
display: flex;
flex-direction: row;
}
.group label:not(:last-child) {
border-bottom: 1px solid #F0F5FA;
}
label > span {
width: 80px;
text-align: right;
margin-right: 30px;
}
.field {
background: transparent;
font-weight: 300;
border: 0;
color: #31325F;
outline: none;
flex: 1;
padding-right: 10px;
padding-left: 10px;
cursor: text;
}
.field::-webkit-input-placeholder { color: #CFD7E0; }
.field::-moz-placeholder { color: #CFD7E0; }
<script src="https://js.stripe.com/v3/"></script>
<body>
<form>
<div class="group">
<label>
<span>Card</span>
<div id="card-element" class="field"></div>
</label>
</div>
</form>
</body>

How do I apply custom styles to a SweetAlert2 popup?

I am using the SweetAlert2 Library in a Vue.js project. The library is working fine with all its features except custom styling.
Based on the documentation, to customize a popup you should add a customClass field to the options object where you define custom class names for each component of the popup.
That is exactly what I did. but the styles do not change.
The code used to include the library:
import Swal from 'sweetalert2'
The code used to fire a swal popup:
Swal.fire({
confirmButtonText: this.confirmBtnTxt,
allowOutsideClick: false,
showCancelButton: false,
title: `Hello ${this.user.firstName} ${this.user.lastName}`,
text: 'Can you please confirm your company',
input: 'select',
customClass: {
container: 'pp-container',
popup: 'pp',
header: 'pp-header',
title: 'pp-title',
content: 'pp-content',
htmlContainer:'pp-html-container',
input: 'pp-input'
},
I have provided all the necessary custom class names, and I am giving those classes styling rules in the styles section of the component:
// Customising swal alerts
.pp {
box-shadow: 0 3px 20px -10px #4a4a4a;
background:black;
}
.pp-title {
display: flex;
font-size: 1.2rem;
color: black;
font-weight: 500;
}
.pp-input {
display: flex;
border: none;
background: #f0f2f7;
padding: 0.7rem 1rem;
font-size: 1rem;
font-weight: 400;
margin-top: 2rem;
}
.pp-html-container {
display: block;
font-size: 0.9rem;
color: #9a9a9a;
}
But the styling doesn't change (see screenshot below).
What am I missing?
I tried this and it is working for me.
Check the demo.
const showAlert = () => {
Swal.fire("Update Successful", "Changes updated successfully!", "success");
}
.swal2-popup {
background: #222 !important;
border: 1px solid white !important;
color: whitesmoke !important;
}
<script src="https://cdn.jsdelivr.net/npm/sweetalert2#11.6.0/dist/sweetalert2.all.js"></script>
<button onclick="showAlert()">Show Alert</button>

CSS for colouring one row of antd table in react

This is the CSS for the antd style I'm using
style.css
.ant-table-tbody > tr > td, .ant-table-thead > tr > th
{
padding:4px;
}
tr:nth-child(odd){
background: #f1e6ff;
}
tr:nth-child(even){
background: white;
}
thead[class*="ant-table-thead"] th{
background-color:#000 !important;
color: white;
font-weight: bold;
border-color: #000;
text-align: center;
}
.table_btn
{
margin:0 !important;
}
.ant-btn
{
margin:0;
}
.ant-table-tbody > tr:hover > td {
color: #fff;
}
index.less
#import "callout";
#import 'e-commerce';
#import "pricing-tables";
#import "login";
#import "dashboard";
#import "error";
#import "editor";
#import "testimonials";
tr:nth-child(odd){
background:inherit !important;
}
.ant-modal-content {
.ant-modal-close{
color: #fff !important;
}
.ant-modal-header {
background-color: #000000;
.ant-modal-title {
color: #fff !important;
}
}
}
.table-wrapper {
.ant-btn {
padding: 0 10px;
height: 30px;
font-size: 13px;
> .anticon {
+ span {
margin-left: 5px;
}
}
&.ant-btn-success {
color: #3d8918;
border-color: #d9d9d9;
&:hover {
background-color:#3d8918;
color: #fff;
}
}
&.ant-btn-danger {
color: #c70d17;
background-color:#fff;
&:hover{
background-color:#c70d17;
color: #fff;
}
}
}
.actions {
text-align: right;
.ant-input {
border-radius: 2px;
padding:0 10px;
font-size: 13px;
height: 30px;
}
}
.table-layout {
.ant-table-small{
> .ant-table-content{
> .ant-table-body {
margin: 0 !important;
> table {
> .ant-table-tbody{
> tr{
> td{
padding: 2px 8px !important;
font-size: 13px !important;
text-align:center;
min-width: 80px;
.ant-btn {
width:100px;
}
}
}
}
}
}
}
index.js
<Table
className="table-layout"
columns={this.state.columns}
dataSource={filteredData}
rowClassName='data-row'
bordered={true}
size={"small"}
onRowDoubleClick={ (record, index, event) => this.handleEditModal(record) }
onRowClick={(record, index, event) => this.handleRowClick(record)}
loading={this.state.loading}
pagination={{ pageSize: 14 }}
/>
This is how Table is used in the index page. style.css and index.less are the pages for CSS.
Can anybody help me to write one CSS in this page for making one row green color ?
I want to make one row green based on condition.
I need the CSS
I need to call the CSS in the page where code is
I found two ways to do this as of now:
One way is to use rowClassName prop of Table:
.table-row-light {
background-color: #ffffff;
}
.table-row-dark {
background-color: #fbfbfb;
}
<Table
rowClassName={(record, index) => index % 2 === 0 ? 'table-row-light' : 'table-row-dark'}
columns={columns}
dataSource={dataSource}
loading={loading}
/>
Second way is to use plain CSS
.table-striped-rows tr:nth-child(2n) td {
background-color: #fbfbfb;
}
.table-striped-rows thead {
background-color: #f1f1f1;
}
<Table
className="table-striped-rows"
columns={columns}
dataSource={dataSource}
loading={loading}
/>
Note that rowClassName works only for rows, so for CSS on table headers we can only use plain CSS like above.
See if these Jsfiddle links helps you. They show 2 ways to change backgroung-color your rows.
https://jsfiddle.net/2b2376a4/
https://jsfiddle.net/2b2376a4/
data: [
{id:1, name: 'one', color: '#fff'},
{id:2, name: 'two', color: '#eee'},
{id:3, name: 'three', color: '#ddd'}
]
for first link
render(text, record) {
return {
props: {
style: { background: record.color },
},
children: <div>{text}</div>,
};
},
for second link
rowClassName={(record) => record.color.replace('#', '')}
if you want to use styled-components you can wrap it like this
const StyledTable: React.FC<TableProps<T>> = styled(Table)`
.ant-table-header th {
background-color: green;
}
`
export const Table = () => (
<StyledTable
columns={columns}
dataSource={data}
...
/>

How to change handsontable row header width?

I can't change the width of the row header using the handsontable spreadsheet.
I've tried the CSS that is referenced in this post: Handsontable increase row header width: From what I've read you can't just use rowWidths like columns but you have to go into the CSS of the row header itself.
.handsontable col.rowHeader {
width: 180px;
}
Picture of the problem.
CSS is here:
html {
background-color: #e6e9e9;
background-image: -webkit-linear-gradient(270deg,rgb(230,233,233) 0%,rgb(216,221,221) 100%);
background-image: linear-gradient(270deg,rgb(230,233,233) 0%,rgb(216,221,221) 100%);
-webkit-font-smoothing: antialiased;
}
body {
margin: 0 auto;
padding: 2em 2em 4em;
max-width: 800px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 1.5em;
color: #545454;
background-color: #ffffff;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
}
a {
color: #34A9DC;
text-decoration: none;
}
p {
margin: 5px 0 20px;
}
h4 {
margin: 20px 0 0;
font-size: 22px;
font-weight: normal;
}
.topcorner {
position:relative;
float:right;
top:0px;
right:16px;
}
#total {
font-size: 20px;
margin: 2 auto;
padding: 4em 4em 4em;
}
.handsontable col.rowHeader {
width: 180px;
}`
Here is the JS for the spreadsheet:
var hot = new Handsontable(container,
{
data: getData(),
colHeaders: ["Quantity","Cost","Amount"],
rowHeaders: ["Flights",
"Taxi & Bus",
"Hotel(nights, cost/night)",
"Breakfast & Lunch",
"Dinners",
"Museum Tickets",
"Live Show Tickets",
"Driving(miles, cost/mile)"],
manualColumnResize: true,
columns: [
{
data: 'quantity',
type: 'numeric',
language: 'en'
},
{
data: 'cost',
type: 'numeric',
format: '$0,0.00',
language: 'en'
},
{
data: 'amount',
type: 'numeric',
format: '$0,0.00',
language: 'en'
}
],
colWidths:[80,120,150]
});
HTML div I'm using: <div id="example" class="handsontable"></div>
You haven't provided anywhere near enough information. All I could suggest is that either;
your CSS is not specific enough and there is not overriding whatever CSS comes with the handsontable library
your using the wrong selector and therefore the CSS is not being applied.
EDIT: Can you try the CSS below;
.ht_clone_left.handsontable tbody tr th { width: 180px; }

Kendo UI & AngularJS Notification CSS works incorrectly

If you look at this plunker and click on the "Show Notification" button you'll see that even though the background is black (background-color: #000000;) there's some gray color on top. What's wrong with this CSS/template?
the HTML:
<body ng-controller="MyCtrl">
<span kendo-notification="notif" k-options="opt" style="display:none;"></span>
<button ng-click="showNotif()">Show Notification</button>
</body>
the JS:
angular.module("KendoDemos", [ "kendo.directives" ]);
function MyCtrl($scope) {
$scope.opt = { position: {
top: 30,
right: 30
},
templates: [{
type: "growl",
template: "<div class='growl'><h1>#= title #</h1><p>#= message #</p></div>"
}]
};
$scope.showNotif = function() {
$scope.notif.show({
title: "This is the title",
message: "and this is the message"
}, "growl");
};
}
the CSS:
.growl {
background-color: #000000;
color: #ffffff;
border: 0;
height:80px;
width:300px;
font-family: Arial;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
You can fix this by applying an overflow: hidden attribute to your .growl style:
.growl {
background-color: #000000;
color: #ffffff;
border: 0;
height:80px;
width:300px;
font-family: Arial;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
overflow: hidden;
}
Nothing to do with Angular or Kendo.
change the CSS to this:
.growl {
...
padding-top:10px;
}
.growl h1 {
margin-top:0;
}
The full answer is already here : Margin on child element moves parent element

Resources