Using scss with ionic - ionic2

I am new to the ionic framework.I had written the code in scss and it is showing some bugs, I had tried to overcome the bugs but i can't.
Below is my scss code:
//colors
$grey: grey;
//fonts
$font_0: Arial;
$font_1: Helvetica;
$font_2: sans-serif;
page-home
{
.displayed: ;
}
.thicker {
font-size: 20px;
font-family: $font_0, $font_1, $font_2;
font-weight: 600;
text-align: center;
margin-top: 5px;
}
.input-label {
font-family: $font_0, $font_1, $font_2;
font-size: 14px;
text-align: center;
text-color: $grey;
}
Is there anyone to help me!!!!

There is an error in your SCSS :
page-home
{
.displayed: ;
}
This will not compile and will throw this error :
Invalid CSS after "{": expected "}", was ".displayed: ;"
When I switch it to :
page-home
{
}
Then it compiles.

https://ionicframework.com/docs/v2/theming/theming-your-app/
You should set the SCSS variables in the theme/variable.scss file when you require global access. All your individual scss files can use it.
page-home {}
"page-home" is your scss namespace for your pageHome.html. It is specified in your component(ts file). All css for that file should be within the namespace.
SCSS tutorial link: http://sass-lang.com/guide

Related

Add file list, delete and download in ESP32 simple file server

It's the first time to ask a question, please forgive me if I am wrong.
English is not my native language; please excuse typing errors.
I am using ESP32 for the first time. I want to be a file server, but now it only has upload function. I want to add download, delete and file list. I have not been able to find suitable information. thank you.
ESP32 code:
#include <Arduino.h>
#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <SPI.h>
#include <SPIFFS.h>
void setup() {
Serial.begin(115200);
if(!SPIFFS.begin()){
Serial.println("An Error has occurred while mounting SPIFFS");
}
start_access_point();
start_web_server();
}
void loop()
{
}
const char* ap_ssid = "ESP32";
const char* ap_pwd = "12345678";
void start_access_point(){
WiFi.softAP(ap_ssid, ap_pwd);
IPAddress myIP = WiFi.softAPIP();
Serial.println("Access point started");
Serial.print("AP IP address: ");
Serial.println(myIP);
}
AsyncWebServer server(80);
const char* PARAM_SSID = "ssid";
const char* PARAM_PWD = "pwd";
void start_web_server(){
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, "/index.html", "text/html");
});
server.on("/upload", HTTP_POST, [](AsyncWebServerRequest *request){
if(request->hasArg("file")){
String fileName = request->arg("file");
File f = SPIFFS.open("/data/fileName", "w");
if(!f){
request->send(500, "text/plain", "Could not open file for writing");
return;
}
std::string fileData = std::string(request->arg("file").c_str());
f.write((uint8_t*)fileData.c_str(), fileData.length());
f.close();
request->send(200, "text/plain", "File uploaded successfully");
}
else{
request->send(500, "text/plain", "No file data found in request");
}
});
server.begin();
}
HTML:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style>.app-container{
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
h3{
text-align: center;
color: #5a5c69 !important;
font-family: Arial, Helvetica, sans-serif;
}
/* Style inputs, select elements and textareas */
input[type=text], select, textarea{
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
resize: vertical;
}
input[type=password], select, textarea{
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
resize: vertical;
}
/* Style the label to display next to the inputs */
label {
padding: 12px 12px 12px 0;
display: inline-block;
}
/* Style the submit button */
input[type=submit] {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
float: right;
}
/* Floating column for labels: 25% width */
.col-25 {
float: left;
width: 25%;
margin-top: 6px;
}
/* Floating column for inputs: 75% width */
.col-75 {
float: left;
width: 75%;
margin-top: 6px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
#media screen and (max-width: 600px) {
.col-25, .col-75, input[type=submit] {
width: 100%;
margin-top: 0;
}
}
</style>
<title id="apptitle">Setup Wifi</title>
<head>
<title>File Upload</title>
</head>
<body>
<h1>File Upload</h1>
<form method="post" action="/upload" enctype="multipart/form-data">
<input type="file" name="file" />
<input type="submit" value="Upload" />
</form>
Download file
</body>
</html>
I tried to find a similar function modification on github, but there was no way
List. Simple iteration through all files in the data folder of esp32. Absolute path deletion before file name has to be done manually if you just want the file names:
#include "SPIFFS.h"
void setup() {
Serial.begin(115200);
if (!SPIFFS.begin(true)) {
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
File root = SPIFFS.open("/");
File file = root.openNextFile();
while(file){
Serial.print("FILE: ");
Serial.println(file.name());
file = root.openNextFile();
}
}
void loop() {}
Delete:
SPIFFS.remove(path); (all paths are absolute paths)
exists function to check if file exists
mkdir creating new folder
rmdir remove folder
opendir
rename
info
and more can be found here. just scroll down enough until you find them in the documentation:
https://arduino-esp8266.readthedocs.io/en/latest/filesystem.html
Edit: Forgot to add download here. Download can be accomplished similarly to what you already have for your API:
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, "/index.html", "text/html");
});
It could send you to a new tab with the new link and use the response as a download buffer type thing. But change the type to the type of file you want. Im not quite sure what the name of the type was but i think it was something on the line of "binary/png" or something. you'd have to search that up

How to change font size and other style of jqgrid 4.15

Trying to update look and feel of jqgrid.
I am trying to increase the font size of the data in the grid as well as of the column header.
Here is my jsfiddle
https://jsfiddle.net/4ga1ekh3/69/
Using the code at
How to change the font size in jqGrid?
.ui-jqgrid {font-size:0.8em}
But this did not work.
I would also like to know how to increase the font of the various fields when of the edit form
Since no one answered here, I resolved this by using the below code:
.ui-jqgrid tr.jqgroup td {
font-weight: bold;
font-size: 12px;
}
.ui-jqgrid .ui-th-column > div.ui-jqgrid-sortable {
font-size: 15px;
}
span.ui-jqgrid-cell-wrapper {
font-size: 16px;
}
td.jqgrid-rownum {
font-size: 15px;
}

Centered divs in small size, but in one row on larger sizes in foundation

I am trying to create two divs using foundation.
I used this code:
<div id=”containerLeftWrap” class=”small-4 small-centered medium-offset-2 medium-2 medium-uncentered columns” >
…content…
</div>
<div id="containerRight" class="medium-7 columns">
<div id="aboutArea">
…content…
</div>
</div>
In small size it looks fine
but in the medium and large size it looks like this
instead of like this
I've tried to add:
style=”display:inline-block; vertical-align:top”
But then the first div (the smaller one) was stuck to the left side, in all sizes, like this:
Does someone have an idea how to solve this?
Thank you!!!!
Update:
I have this css:
#containerLeftWrap {
background-color: #262626;
height: 256px;
min-width: 245px;
padding-top: 28px;
border-radius: 7px;
margin-top: 60px;
}
#aboutArea {
width: 90%;
margin: 0 auto;
background-color: #262626;
border-radius: 7px;
padding-bottom: 15px;
}

UL accordion in foundation 4

I am new to foundation 4 and we are currently using foundation 4 in our project MVC4 + Foundation 4 (through NuGet package)
We want to use accordions on our views.
Foundation 4 offers Sections; http://foundation.zurb.com/docs/components/section.html
but as this looks too bland on the website, we looked at foundation 3 accordion which we felt suited our website; http://foundation.zurb.com/old-docs/f3/elements.php.
Need experts help in understanding how can we make the look & feel of accordions sections similar to the one's available in foundation 3.
We understand foundation 4 doesnot offer images anymore, so how can we implement the small icons on the right.
I'm no expert, but if I understand correctly you just want to add the little triangle image on the right. First of all, are you using scss files ? If not you should definitely check it out here. All you need is to install this visual studio plugin, then download and add the zurb-foundation scss files to your project.
Next up, go to the _section.scss file and look for this part of the code:
#mixin section($section-type:accordion) {
// Accordion styles
#if $section-type == accordion {
border-top: $section-border-size $section-border-style $section-border-color;
position: relative;
.title {
top: 0;
cursor: pointer;
width: 100%;
margin: 0;
background-color: $section-title-bg;
***********************************
*** add a background image here ***
***********************************
a {
padding: $section-padding;
display: inline-block;
color: $section-title-color;
font-size: emCalc(14px);
white-space: nowrap;
width: 100%;
}
&:hover { background-color: darken($section-title-bg, $section-function-factor/2); }
}
.content {
display: none;
padding: $section-padding;
background-color: $section-content-bg;
&>*:last-child { margin-bottom: 0; }
&>*:first-child { padding-top: 0; }
&>*:last-child { padding-bottom: 0; }
}
&.active {
.content { display: block; }
.title { background: $section-title-bg-active;
**********************************************
*** add the "active" background image here ***
**********************************************
}
}
}
There are two ways to add the triangle, either use an image of your choice, or even better, use foundation's css function that creates triangles !
#include css-triangle(5px, #aaaaaa, top);
Note I have not tested modifying foundation's sections, but I'm pretty sure this should do the trick.
SCSS is always the best option. But, for others who are not yet ready to dive into SCSS, you can do it via CSS. In your CSS file, just include the following:
.section-container.accordion > section > .title:after,
.section-container.accordion > .section > .title:after {
content: '\25B8';
position:absolute;
right:10px;
font-size:22px;
}
.section-container.accordion > section.active > .title:after,
.section-container.accordion > .section.active > .title:after {
content: '\25BE';
position:absolute;
right:10px;
font-size:22px;
}
Of course, you can change the font-size as desired or you can simply ommit it. Hope that helps.

height auto css issue

I tried to set the height of my webpage to auto with no success. When the text grows, it overlaps the footer. Any ideas where I am getting it wrong? I want to extend the .main class when the text grows.
.main {
background-position: right bottom;
min-height: 1200px;
background-color: #FFFFFF;
background-image: url('../images/side-shape.png');
background-repeat: no-repeat;
height:auto !Important;
}
just remove this line from your footer class
margin-top: -175px;
Looks like you need to clear the float you have in your left column. Put clear: both; in your footer_wrapper and that should fix this.