I have a carousel imported directly from bootstrap-react. It is functioning fine: it slides on its own, the three nav sliders navigate through the images, the the left slider arrow works perfectly, however, the right slider arrow only seems to have an active hover effect to click and slide at the top of the div. When I inspect the element, it shows up fine. I don't know how to address this issue as I am new to react and bootstrap.
Here is a link showing the behavior:
you can see that the link won't become active
Here is the Carousel Component:
import { Carousel } from "react-bootstrap";
import { LinkContainer } from "react-router-bootstrap";
const ProductCarouselComponent = () => {
const cursorP = {
cursor: "pointer",
};
return (
<Carousel>
<Carousel.Item>
<img
crossOrigin="anonymous"
className="d-block w-100"
style={{ height: "300px", ObjectFit: "cover" }}
src="/images/carousel/carousel-1.png"
alt="First slide"
/>
<Carousel.Caption>
<LinkContainer style={cursorP} to="/product-details">
<h3>Bestseller in Laptops</h3>
</LinkContainer>
<p>Dell Inspiron 15 3000 Laptop, 15.6 inch HD </p>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<img
className="d-block w-100"
style={{ height: "300px", ObjectFit: "cover" }}
src="/images/carousel/carousel-2.png"
alt="Second slide"
/>
<Carousel.Caption>
<LinkContainer style={cursorP} to="/product-details">
<h3>Bestseller in Books</h3>
</LinkContainer>
<p>Don Quixote by Miguel de Cervantes (audiobook)</p>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<img
className="d-block w-100"
style={{ height: "300px", ObjectFit: "cover" }}
src="/images/carousel/carousel-3.png"
alt="Third slide"
/>
<Carousel.Caption>
<LinkContainer style={cursorP} to="/product-details">
<h3>Bestseller in Cameras</h3>
</LinkContainer>
<p>
4k Camcorder Video Camera 60FPS 48MP Vlogging Camera for Youtube WiFi 16X Digital Camera
</p>
</Carousel.Caption>
</Carousel.Item>
</Carousel>
);
};
export default ProductCarouselComponent;
Here is the Home Page where it is imported
import ProductCarouselComponent from "../components/user/ProductCarouselComponent";
import CategoryCardComponent from "../components/user/CategoryCardComponent";
import { Row, Container } from "react-bootstrap";
const HomePage = () => {
const categories = [
"Tablets",
"Monitors",
"Games",
"Printers",
"Software",
"Cameras",
"Books",
"Videos",
];
return (
<>
<ProductCarouselComponent />
<Container /*className="bg-dark"*/>
<Row xs={1} md={2} /*lg={3}*/ className="g-4 mt-5">
{categories.map((category, idx) => (
<CategoryCardComponent key={idx} category={category} idx={idx} />
))}
</Row>
</Container>
</>
);
};
export default HomePage;
Here is the package.json page:
{
"name": "mernstack-ecommerce-site",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^13.5.0",
"bootstrap": "^5.2.2",
"bootstrap-icons": "^1.9.1",
"react": "^18.2.0",
"react-bootstrap": "^2.5.0",
"react-dom": "^18.2.0",
"react-router-bootstrap": "^0.26.2",
"react-router-dom": "^6.4.2",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Related
I am using jest and testing-library/svelte to write tests in SvelteKit. I have a simple text-component and want to test, if the line-height of the text is big enough depending on the font-size (because of accessibility reasons). For this, I want to use the window.getComputedStyle(...) method. However, if I am using it in a test, the font-size is NOT returned in pixel, but the unit I used in the actual css.
Text.svelte:
<div class="text">
<slot></slot>
</div>
<style>
.text {
text-align: left;
font-size: 1.2em;
line-height: 2.4em;
}
</style>
Text.spec.ts
/**
* #jest-environment jsdom
*/
import '#testing-library/jest-dom';
import { render } from "#testing-library/svelte";
import Text from "./Text.svelte";
describe("Text component", () => {
test("text must have a minimum line-height of 1.5x the font-size", () => {
const { container } = render(Text);
const textDiv = container.querySelector(".text");
const fontSize = window.getComputedStyle(textDiv).getPropertyValue('font-size')
const lineHeight = window.getComputedStyle(textDiv).getPropertyValue('line-height')
console.log("fontSize:", fontSize) // Output --> font-size: 1.2em
console.log("lineHeight:", lineHeight) // Output --> line-height: 2.4em
});
});
jest.config.cjs
module.exports = {
transform: {
"^.+\\.svelte$": [
"svelte-jester",
{ preprocess: "./svelte.config.js" },
],
"^.+\\.ts$": "ts-jest",
"^.+\\.js$": "ts-jest",
},
moduleFileExtensions: ["js", "ts", "svelte"],
moduleNameMapper: {
"^\\$lib(.*)$": "<rootDir>/src/lib$1",
"^\\$app(.*)$": [
"<rootDir>/.svelte-kit/dev/runtime/app$1",
"<rootDir>/.svelte-kit/build/runtime/app$1",
],
},
setupFilesAfterEnv: ["<rootDir>/jest-setup.ts"],
collectCoverageFrom: ["src/**/*.{ts,tsx,svelte,js,jsx}"],
};
jest-setup.ts
import "#testing-library/jest-dom";
Just in case, here are the relevant dependencies from my package.json
{
"devDependencies": {
"#testing-library/jest-dom": "^5.16.3",
"#testing-library/svelte": "^3.1.0",
"#types/jest": "^27.4.1",
"jest": "^27.5.1",
"svelte": "^3.46.6",
"svelte-check": "^2.2.6",
"svelte-jester": "^2.3.2",
"svelte-loader": "^3.1.2",
"svelte-preprocess": "^4.10.1",
"svelte2tsx": "^0.5.6",
"ts-jest": "^27.1.4",
"tslib": "^2.3.1",
"typescript": "~4.6.2"
},
"type": "module"
}
So how can I get the font-size and line-height in pixels. Is this even possible in a jest-test? I'd appreciate every answer, ideas or suggestions!
I am unsure what is going wrong here. I followed the steps on switching from vue-cli to vite and it seems I have missed some steps because my website is not being displayed. I have checked several different repositories and I don't know how my code is any different than theirs who have working websites using vite. I am just going to post a few of my files that hopefully should make the issue I have obvious. If the answer is not obvious from the code I have posted I can go back to my codebase, troubleshoot again and if that fails then display more info in this question.
Edit:: I forgot to mention that the one error I get in the developer console for chrome is
"Failed to load resource: the server responded with a status of 404 (Not Found)" for Footer:1. I am unsure why this error is occuring.
Any feedback will be appreciated.
src/app.vue:
<template>
<router-view />
<Footer />
</template>
<script>
//import Navbar from "#/components/Navbar";
import Footer from "#/components/Footer";
export default {
name: "App",
components: {
//Navbar,
Footer
},
data: () => ({
}),
};
</script>
<style>
#app {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: black;
display: flex;
flex-direction: column;
height: 100%;
}
body {
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
margin: 0px ;
}
.centre-body{
flex: 1 0 auto;
}
</style>
src/main.vue
import { createApp } from 'vue'
import App from "./App.vue";
import router from "./router/index";
import store from "./store/index";
Vue.config.productionTip = false;
createApp(App).use(router).use(store).mount('#app')
vite.config.js
import { defineConfig } from 'vite'
import vue from '#vitejs/plugin-vue'
const path = require("path");
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
"#": path.resolve(__dirname, "./src"),
},
},
});
package.json
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src"
},
"dependencies": {
"#vitejs/plugin-vue": "^1.6.1",
"#vue-leaflet/vue-leaflet": "^0.6.0",
"axios": "^0.21.1",
"global": "^4.4.0",
"highcharts": "^9.0.1",
"loading-visualization": "^1.2.14",
"mapbox-gl": "^1.0.0",
"vue": "^3.0.0",
"vue-router": "^4.0.0-0",
"vue3-echarts": "^1.0.3",
"vue3-highcharts": "^0.1.3",
"vueperslides": "^3.2.0",
"vuex": "^4.0.0-0"
},
"devDependencies": {
"#vue/compiler-sfc": "^3.0.0",
"#vue/eslint-config-prettier": "^6.0.0",
"eslint": "^8.10.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^8.5.0",
"prettier": "^1.19.1",
"sass": "^1.26.5",
"vite": "^2.8.6",
"vue-loader-v16": "^16.0.0-beta.5.4"
}
}
src/router/index.js
import { createRouter, createWebHashHistory } from "vue-router"
import Home from "../views/Home.vue"
import Information from "../views/Information.vue"
import Contact from "../views/Contact.vue"
import ExploreScience from "../views/ExploreScience.vue"
import ProjectData from "../views/ProjectData.vue"
const routes = [
{
path: "/",
name: "Home",
component: Home
},
{
path: "/Information",
name: "Information",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: Information
},
{
path: "/Contact",
name: "Contact",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: Contact
},
{
path: "/ProjectData",
name: "ProjectData",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: ProjectData
},
{
path: "/exploreScience",
name: "ExploreScience",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: ExploreScience
},
];
const router = createRouter({
mode: "history",
base: import.meta.env.BASE_URL,
routes,
});
export default router
The error message seems to point here:
import Footer from "#/components/Footer";
Notice the file extension is missing. That worked in a Vue CLI scaffolded project because it was possible to configure default file extensions.
In Vite, the file extension is required in the path for the import to succeed:
import Footer from "#/components/Footer.vue";
👆
I have a moderately simple example of a React Hooks widget whose function it is to provide context hooks to provide state that can set a few strings and switch the current Material UI theme. Here is the working demo. By clicking on the button labeled "NEXT THEME" you can see the page toggle between yellow and blue, along with some text changes indicating the name of the theme.
Its a contrived example, but the idea is that at the top of my site, I'm wrapping all content with context providers so that any nested widget can access shared state. Looks like this:
import React from "react";
import { AppContext } from "./AppContext";
import { ThemeContextProvider } from "./ThemeContext";
export default function App(props) {
return (
<div>
<ThemeContextProvider>
<AppContext>{props.children}</AppContext>
</ThemeContextProvider>
</div>
);
}
Everything is working as I said in the demo I've linked above. But when I publish this code to NPM and then use it in another project, it mostly works except for one import piece--the theme color will not change. All other state changes work right--all of the other state changes are textual and there are no problems, but the color will not change.
The theme is provided by Material UI, and I suspect that there is an issue with the way that I am rolling all this code up for publishing to NPM. I am using Rollup--here is rollup.config.js:
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import external from 'rollup-plugin-peer-deps-external';
import resolve from 'rollup-plugin-node-resolve';
import json from '#rollup/plugin-json';
const {terser} = require('rollup-plugin-terser');
import pkg from './package.json';
export default {
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true
},
{
file: pkg.module,
format: 'es',
sourcemap: true
}
],
plugins: [
external(),
// url({ exclude: ['**/*.svg'] }),
babel({
exclude: 'node_modules/**',
runtimeHelpers: true
}),
resolve({
preferBuiltins: true,
browser: true
}),
commonjs({
include: 'node_modules/**',
browser: true,
namedExports: {
'node_modules/react/index.js': [
'createContext',
'useContext',
'useEffect',
'useState'
],
'node_modules/react-is/index.js': [
'ForwardRef',
'Memo'
],
'node_modules/prop-types/index.js': [
'elementType'
]
}
}),
terser(),
json()
]
};
And here is my package.json:
{
"name": "#data-factory/theme-context-test",
"version": "0.0.1",
"description": "Code from CodeSandbox",
"author": "sellis42",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "rollup -c",
"start": "rollup -c -w",
"prepare": "npm run build",
"predeploy": "cd example && npm install && npm run build"
},
"peerDependencies": {
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"devDependencies": {
"#babel/core": "^7.9.0",
"#babel/plugin-transform-runtime": "^7.9.0",
"#babel/preset-env": "^7.9.0",
"#babel/preset-react": "^7.0.0",
"#babel/runtime": "^7.9.2",
"#material-ui/core": "^4.9.8",
"#material-ui/icons": "^4.9.1",
"#material-ui/styles": "^4.9.6",
"#rollup/plugin-json": "^4.0.2",
"cross-env": "^5.2.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "^3.4.0",
"rollup": "^1.32.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-node-resolve": "^4.2.4",
"rollup-plugin-peer-deps-external": "^2.2.2",
"rollup-plugin-terser": "^4.0.4",
"typeface-roboto": "0.0.75"
}
}
I feel as if there is something missing from my rollup configuration. This project is on my local development system and is slightly different that the linked code. I essentially have all the code that I publish in the root of the widget module, and an example folder that demonstrates how to use the widget. I use npm link so that the example widget can use it, and that is where I see the issue I'm trying to resolve. I can copy the entire root widget to a subfolder of the example src and import it from there instead of from NPM and it works again.
Any help or ideas would be appreciated. I can put all of my code to Git if anyone is interested in taking a deeper look.
I've sidestepped the issue altogether by not using a ThemeProvider in the ThemeContext. Here is what is returned by the ThemeContext hook (source abbreviated):
return (
<ThemeContext.Provider value={{theme, setTheme ... }}>
<ThemeProvider theme={theme}>{props.children}</ThemeProvider>
</ThemeContext.Provider>
);
I changed this to:
return (
<ThemeContext.Provider value={{theme, setTheme ... }}>
{props.children}
</ThemeContext.Provider>
);
It is the responsibility of children then to supply a ThemeProvider. As long as I avoid providing the ThemeProvider in my hooks I seem to be ok.
I'm not sure why this is, but I can live with it.
I am trying to import only the Navbar, Modal and Dropdown from Buefy and running into errors trying to do the same
I also want only the relevant scss files
I have tried multiple methods so far and nothing works
Method 1
npx create-nuxt-app custombuefy
Do not select any frontend framework here
Step 1 Install Bulma
npm i node-sass sass-loader -D
npm i bulma
Create app.scss inside styles folder inside assets directory
#import "~bulma" inside app.scss
Include '~/assets/styles/app,scss' inside css section of nuxt.config.js
npm run build && npm run start, Check if page with Bulma runs on localhost:3000
Runs successfully at this stage
Step 2 Install Normal Buefy without nuxt-buefy
npm i buefy
Create buefy.js file inside plugins directory
Add '~/plugins/buefy.js' to plugins section of nuxt.config.js
Add the following code to import BDropdown, BModal, BNavbar from buefy
Included the CSS directly here initially
import Vue from 'vue'
import { BDropdown, BDropdownItem, BModal, BNavbar } from 'buefy'
import 'buefy/dist/buefy.min.css'
Vue.use(BDropdownItem)
Vue.use(BDropdown)
Vue.use(BModal)
Vue.use(BNavbar)
Add the dropdown to the code in index.
pages/index.vue file
<template>
<div class="container">
<div>
<logo />
<b-dropdown aria-role="list">
<button
slot="trigger"
slot-scope="{ active }"
class="button is-primary"
>
<span>Click me!</span>
<b-icon :icon="active ? 'menu-up' : 'menu-down'"></b-icon>
</button>
<b-dropdown-item aria-role="listitem">Action</b-dropdown-item>
<b-dropdown-item aria-role="listitem">Another action</b-dropdown-item>
<b-dropdown-item aria-role="listitem">Something else</b-dropdown-item>
</b-dropdown>
</div>
</div>
</template>
<script>
import Logo from '~/components/Logo.vue'
export default {
components: {
Logo,
},
}
</script>
<style>
.container {
margin: 0 auto;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
.title {
font-family: 'Quicksand', 'Source Sans Pro', -apple-system, BlinkMacSystemFont,
'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
display: block;
font-weight: 300;
font-size: 100px;
color: #35495e;
letter-spacing: 1px;
}
.subtitle {
font-weight: 300;
font-size: 42px;
color: #526488;
word-spacing: 5px;
padding-bottom: 15px;
}
.links {
padding-top: 15px;
}
</style>
nuxt.config.js
module.exports = {
mode: 'universal',
/*
** Headers of the page
*/
head: {
title: process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content: process.env.npm_package_description || '',
},
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: ['~/assets/styles/app.scss'],
/*
** Plugins to load before mounting the App
*/
plugins: ['~/plugins/buefy'],
/*
** Nuxt.js dev-modules
*/
buildModules: [
// Doc: https://github.com/nuxt-community/eslint-module
'#nuxtjs/eslint-module',
// Doc: https://github.com/nuxt-community/stylelint-module
'#nuxtjs/stylelint-module',
],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://axios.nuxtjs.org/usage
'#nuxtjs/axios',
'#nuxtjs/pwa',
// Doc: https://github.com/nuxt-community/dotenv-module
'#nuxtjs/dotenv',
],
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {},
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend(config, ctx) {},
},
}
Result
ERROR Cannot read property 'install' of undefined 16:19:41
at Function.t.use (node_modules/vue/dist/vue.runtime.common.prod.js:6:36869)
at Module.<anonymous> (server.js:1:559776)
at r (server.js:1:194)
at Object.<anonymous> (server.js:1:5233)
at r (server.js:1:194)
at server.js:1:1259
at Object.<anonymous> (server.js:1:1269)
at o (node_modules/vue-server-renderer/build.prod.js:1:77607)
at node_modules/vue-server-renderer/build.prod.js:1:78200
at new Promise (<anonymous>)
Method 2
Lets modify the plugins/buefy.js file to instead use dist/esm modules
import Vue from 'vue'
import { BDropdown, BDropdownItem } from 'buefy/dist/esm/dropdown'
import 'buefy/dist/buefy.min.css'
Vue.use(BDropdownItem)
Vue.use(BDropdown)
Result
ERROR Cannot use import statement outside a module 16:23:03
(function (exports, require, module, __filename, __dirname) { import './chunk-6ea13200.js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at new Script (vm.js:88:7)
at createScript (vm.js:263:10)
at Object.runInThisContext (vm.js:311:10)
at wrapSafe (internal/modules/cjs/loader.js:1059:15)
at Module._compile (internal/modules/cjs/loader.js:1122:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
Method 3
Lets use the components from the components directory instead. We again modify plugins/buefy.js file as follows
import Vue from 'vue'
import { BDropdown, BDropdownItem } from 'buefy/dist/components/dropdown'
import 'buefy/dist/buefy.min.css'
Vue.use(BDropdownItem)
Vue.use(BDropdown)
Result
Now I get a new error saying Unknown custom element in Browser console and the dropdown appears completely broken
In case this is a dependency issue, here is my package.json file
{
"name": "custombuefy",
"version": "1.0.0",
"description": "My marvelous Nuxt.js project",
"author": "",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
"build": "nuxt build",
"start": "cross-env NODE_ENV=production node server/index.js",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"test": "jest"
},
"lint-staged": {
"*.{js,vue}": "npm run lint",
"*.{css,vue}": "stylelint"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"dependencies": {
"#nuxtjs/axios": "^5.9.7",
"#nuxtjs/dotenv": "^1.4.1",
"#nuxtjs/pwa": "^3.0.0-beta.20",
"buefy": "^0.8.15",
"bulma": "^0.8.2",
"cross-env": "^7.0.2",
"express": "^4.17.1",
"nuxt": "^2.12.2"
},
"devDependencies": {
"#nuxtjs/eslint-config": "^2.0.2",
"#nuxtjs/eslint-module": "^1.1.0",
"#nuxtjs/stylelint-module": "^3.2.2",
"#vue/test-utils": "^1.0.0-beta.33",
"babel-eslint": "^10.1.0",
"babel-jest": "^25.3.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-nuxt": ">=0.5.2",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^4.2.5",
"jest": "^25.3.0",
"lint-staged": "^10.1.5",
"node-sass": "^4.13.1",
"nodemon": "^2.0.3",
"prettier": "^2.0.4",
"sass-loader": "^8.0.2",
"stylelint": "^13.3.2",
"vue-jest": "^4.0.0-0"
}
}
Can someone please tell me how I can import only the Dropdown, Navbar and Modal from Buefy without running into all these errors?
import Vue from 'vue'
import { Dropdown, Icon } from 'buefy'
Vue.use(Dropdown)
Vue.use(Icon)
Fixed the issue but component wise scss is still not working
With app.scss as
#import "~bulma";
#import "~buefy/src/scss/buefy";
Buefy styles are not getting applied to the dropdown
UPDATE
Even SCSS can be imported partially
#import "~buefy/src/scss/utils/_all";
#import "~buefy/src/scss/components/_autocomplete";
#import "~buefy/src/scss/components/_dropdown";
#import "~buefy/src/scss/components/_notices";
<ion-toolbar color="dark">
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
<ion-title>
Home
</ion-title>
</ion-toolbar>
Menu icon is not visible in the above ionic4 code
You need to add it explicitly in Ionic 4:
<ion-header>
<ion-toolbar color="dark">
<ion-buttons slot="start">
<ion-menu-button autoHide="true"></ion-menu-button>
<ion-back-button [defaultHref]="defaultHref"></ion-back-button>
</ion-buttons>
<ion-title>Home</ion-title>
</ion-toolbar>
</ion-header>
And you can set a default path for when no history exist: defaultHref = '/some/route/';
If this doesn't work, double check that your angular.json config includes this:
{
"assets": [
{
"glob": "**/*",
"input": "src/assets",
"output": "assets"
},
{
"glob": "**/*.svg",
"input": "node_modules/ionicons/dist/ionicons/svg",
"output": "./svg"
}
]
}
Try changing the color of back button, as you are giving color dark to toolbar, it might be the case it got hidden because of that.