diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9b196de..846b8c1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,28 +1,51 @@ -name: Deployment +name: CI/CD Pipeline on: push: branches: - master + pull_request: + branches: + - master + env: - CI: false + CI: true + jobs: + # test: + # runs-on: ubuntu-latest + # strategy: + # matrix: + # node-version: [18.x] # Updated Node.js version + # steps: + # - uses: actions/checkout@v4 + # - name: Use Node.js ${{ matrix.node-version }} + # uses: actions/setup-node@v4 + # with: + # node-version: ${{ matrix.node-version }} + # - name: Install dependencies + # run: yarn install + # - name: Run tests + # run: yarn test --watchAll=false --ci + deploy: + # needs: test runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' strategy: matrix: - node-version: [12.x] + node-version: [18.x] # Updated Node.js version steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Install Packages - run: npm install - - name: Build page - run: npm run build - - name: Deploy to gh-pages - uses: peaceiris/actions-gh-pages@v3 - with: - deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} - publish_dir: ./build \ No newline at end of file + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Install Packages + run: yarn install + - name: Build page + run: yarn build + - name: Deploy to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} + publish_dir: ./build \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 420c372..0000000 --- a/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# production -/build - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.eslintcache \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 145ffd9..0000000 --- a/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# vf-react - -A React boilerplate for VF 2.0 projects. - -Demo: https://visual-framework.github.io/vf-react/ - -Notes: - -- If you add a Visual Framework component, be sure to include it at `src/vf-components/vf-componenet-rollup/index.scss` -- Add custom CSS to `src/vf-components/vf-local-overrides/vf-local-overrides.scss` -- Bootstrapped with [Create React App](https://github.com/facebook/create-react-app), that brings certain advantages and limitations. If you want to escape those, read up on "[eject](https://create-react-app.dev/docs/available-scripts#npm-run-eject)" - -Watchout for: - -- Use `yarn` and not `npm` -- This is still in early development -- The building of VF component assets (CSS, JS, images, etc.) from `.vf-components` into `./build/vf-generated-assets` does not seem to be working after [#25](https://github.com/visual-framework/vf-react/pull/25) -- Gulp may eventually removed from this project -- We're still coming up with an approach on how to handle the use of VF JS inside React (probably we'll import the VF JS modules directly) - -## Available scripts - -In the project directory, you can run: - -### `gulp build-vf-assets` - -Build the assets, CSS and JS for VF components. - -### `gulp dev` - -- Build the assets, CSS and JS for VF components and watch for changes -- Run React in development mode - -### `gulp build` - -- Build the assets, CSS and JS for VF components -- Run React in build mode (yarn start) - -### `yarn test` - -Launches the test runner in the interactive watch mode.
-See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index cd24ccf..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,45 +0,0 @@ -const path = require('path'); -const gulp = require('gulp'); -const shell = require('gulp-shell'); - -// Pull in optional configuration from the package.json file, a la: -const {componentPath, componentDirectories, buildDestionation} = require('@visual-framework/vf-config'); - -// Tasks to build/run vf-core component system -require('@visual-framework/vf-core/gulp-tasks/_gulp_rollup.js')(gulp, path, componentPath, componentDirectories, buildDestionation); - -// Watch folders for changes -gulp.task('watch', function() { - // gulp.watch(['./vf-components/**/*.scss', '!./vf-components/**/package.variables.scss'], gulp.parallel('vf-css')); - // gulp.watch(['./vf-components/**/*.js'], gulp.parallel('vf-scripts')); -}); - -// run react in build mode -gulp.task('react:build', shell.task( - ['react-scripts build'] -)); - -// run react in dev mode -gulp.task('react:dev', shell.task( - ['react-scripts start'] -)); - -// Let's build this sucker. -gulp.task('build', gulp.series( - 'vf-clean', - gulp.parallel('vf-component-assets'), - 'react:build' -)); - -// Just build the assets, CSS and JS for VF components -gulp.task('build-vf-assets', gulp.series( - 'vf-clean', - gulp.parallel('vf-component-assets') -)); - -// Build and watch things during dev -gulp.task('dev', gulp.series( - 'vf-clean', - gulp.parallel('vf-component-assets'), - gulp.parallel('react:dev','watch') -)); diff --git a/package.json b/package.json index 001165c..38c62f8 100644 --- a/package.json +++ b/package.json @@ -1,90 +1,51 @@ { "name": "vf-react", "version": "0.1.0", - "vfConfig": { - "vfName": "VF Boilerplate for React", - "vfNamespace": "vfreact-", - "vfComponentPath": "@visual-framework", - "vfBuildDestination": "./build/vf-generated-assets", - "vfThemePath": "@frctl/mandelbrot" - }, - "homepage": "/vf-react", - "scripts": { - "start": "gulp dev", - "predeploy": "gulp build", - "deploy": "gh-pages -d build", - "build": "gulp build", - "test": "react-scripts test", - "eject": "react-scripts eject", - "update-components": "yarn upgrade-interactive --latest" - }, + "private": true, "dependencies": { - "@visual-framework/embl-grid": "2.1.2", - "@visual-framework/vf-banner": "1.9.0", - "@visual-framework/vf-body": "1.2.0", - "@visual-framework/vf-breadcrumbs": "2.0.4", - "@visual-framework/vf-button": "1.4.3", - "@visual-framework/vf-card": "2.6.0", - "@visual-framework/vf-cluster": "1.0.2", - "@visual-framework/vf-code-example": "1.3.0", - "@visual-framework/vf-collapse": "0.0.2", - "@visual-framework/vf-config": "1.0.1-alpha.0", - "@visual-framework/vf-content": "1.6.1", - "@visual-framework/vf-core": "2.2.30", - "@visual-framework/vf-design-tokens": "3.6.0", - "@visual-framework/vf-details": "1.2.0", - "@visual-framework/vf-extensions-react": "0.0.4", - "@visual-framework/vf-flag": "1.0.0-alpha.2", + "@testing-library/jest-dom": "^5.17.0", + "@testing-library/react": "^13.4.0", + "@testing-library/user-event": "^13.5.0", + "@visual-framework/vf-back-to-top": "^1.0.1", + "@visual-framework/vf-badge": "^3.0.3", + "@visual-framework/vf-banner": "2.0.3", + "@visual-framework/vf-blockquote": "^1.2.8", + "@visual-framework/vf-body": "^1.2.0", + "@visual-framework/vf-box": "^2.4.0", + "@visual-framework/vf-button": "3.0.2", + "@visual-framework/vf-card": "2.7.2", + "@visual-framework/vf-content": "1.6.16", + "@visual-framework/vf-core": "2.2.47", "@visual-framework/vf-font-plex-mono": "1.1.1", "@visual-framework/vf-font-plex-sans": "1.1.1", - "@visual-framework/vf-footer": "1.2.0", - "@visual-framework/vf-form__checkbox": "3.0.0-alpha.0", - "@visual-framework/vf-form__select": "3.0.0-alpha.0", - "@visual-framework/vf-global-header": "3.1.2", - "@visual-framework/vf-grid": "1.4.1", - "@visual-framework/vf-grid-page": "3.0.0", - "@visual-framework/vf-header": "2.0.2", - "@visual-framework/vf-heading": "1.0.1", - "@visual-framework/vf-hero": "3.3.0", - "@visual-framework/vf-intro": "1.5.0", - "@visual-framework/vf-lede": "1.0.1", - "@visual-framework/vf-logo": "1.5.1", - "@visual-framework/vf-navigation": "3.0.0-beta.1", - "@visual-framework/vf-no-js": "1.0.1", - "@visual-framework/vf-page-header": "1.1.2", + "@visual-framework/vf-grid": "^1.4.1", + "@visual-framework/vf-hero": "^4.0.3", + "@visual-framework/vf-global-header": "^3.1.6", + "@visual-framework/vf-footer": "^1.2.1", + "@visual-framework/vf-link": "^2.0.2", "@visual-framework/vf-sass-config": "2.6.1", - "@visual-framework/vf-sass-starter": "0.1.23", - "@visual-framework/vf-search": "3.0.0-alpha.0", - "@visual-framework/vf-sidebar": "1.0.0-alpha.2", - "@visual-framework/vf-stack": "2.1.1", - "@visual-framework/vf-table": "1.2.0-rc.2", - "@visual-framework/vf-tabs": "2.0.1", - "@visual-framework/vf-text": "1.0.2", - "@visual-framework/vf-u-fullbleed": "1.2.2", + "@visual-framework/vf-sass-starter": "^0.1.30", "@visual-framework/vf-utility-classes": "2.0.0", - "gh-pages": "3.2.3", - "gulp": "4.0.2", - "gulp-autoprefixer": "8.0.0", - "gulp-babel": "8.0.0", - "gulp-better-rollup": "4.0.1", - "gulp-cssnano": "2.1.3", - "gulp-notify": "4.0.0", - "gulp-rename": "2.0.0", - "gulp-sass": "5.0.0", - "gulp-shell": "0.8.0", - "gulp-sourcemaps": "3.0.0", - "gulp-stylelint": "13.0.0", - "gulp-svgmin": "4.0.1", - "gulp-watch": "5.0.1", - "list-stream": "2.0.0", - "react": "17.0.2", - "react-dom": "17.0.2", - "react-router-dom": "5.2.0", - "react-scripts": "4.0.3", - "rollup-plugin-includepaths": "0.2.4" + "@visual-framework/vf-mega-menu": "^1.0.2", + "@visual-framework/vf-profile": "^1.4.0", + "@visual-framework/vf-search": "^1.0.0", + "@visual-framework/vf-stack": "^3.0.0", + "@visual-framework/vf-tabs": "^2.1.5", + "@visual-framework/vf-text": "^1.1.1", + "@visual-framework/vf-u-fullbleed": "^1.2.2", + "@visual-framework/vf-extensions-react": "^0.0.8", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-router-dom": "^6.21.1", + "react-scripts": "5.0.1", + "sass": "^1.69.5", + "web-vitals": "^2.1.4" }, - "eslintConfig": { - "extends": "react-app" + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" }, "browserslist": { "production": [ diff --git a/public/index.html b/public/index.html index a51db88..6551aeb 100644 --- a/public/index.html +++ b/public/index.html @@ -1,43 +1,46 @@ - - + + - - - - - - + + + + - - - React App - - - -
- + + + + + - You can add webfonts, meta tags, or analytics to this file. - The build step will place the bundled scripts into the tag. - - To begin the development, run `npm start` or `yarn start`. - To create a production bundle, use `npm run build` or `yarn build`. - --> + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/renovate.json b/renovate.json deleted file mode 100644 index f45d8f1..0000000 --- a/renovate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": [ - "config:base" - ] -} diff --git a/src/App.js b/src/App.js deleted file mode 100644 index 17f5312..0000000 --- a/src/App.js +++ /dev/null @@ -1,57 +0,0 @@ -import React from 'react'; -import { HashRouter as Router, Route, Link, NavLink } from "react-router-dom"; -import VfLogoPath from '@visual-framework/vf-logo/assets/logo.svg'; -import Home from './Home'; -import TestPage from './TestPage'; -import ComponentShowcase from './components/components-showcase/ComponentShowcase'; -// import './vf-components/vf-componenet-rollup/index.scss'; - -// VF njk templates -// import { VfLogo } from './vf-components/vf-extensions-react/vf-extensions-react.jsx'; - -function App() { - return ( - -
-
- - Visual Framework 2.0 - - - -
- - - - - -
-
- ); -} - -export default App; diff --git a/src/App.jsx b/src/App.jsx new file mode 100644 index 0000000..c62aa95 --- /dev/null +++ b/src/App.jsx @@ -0,0 +1,55 @@ +import React, { useEffect } from 'react'; +import { BrowserRouter as Router, Routes, Route, useLocation } from 'react-router-dom'; +import Header from './components/Header'; +import Footer from './components/Footer'; +import Home from './components/Home'; +import VFBadge from './components/VFBadge'; +import VFBackToTop from './components/VFBackToTop'; +import VFButton from './components/VFButton'; +import VFCard from './components/VFCard'; +import VFBlockquote from './components/VFBlockquote'; +import VFHero from './components/VFHero'; +import VFBanner from './components/VFBanner'; +import VFTabs from './components/VFTabs'; + +// Create a wrapper component to handle route changes +function RouteChangeHandler({ children }) { + const location = useLocation(); + + useEffect(() => { + // This runs on every route change + const vfMegaMenuContent = document.querySelector('.vf-mega-menu__content'); + if (vfMegaMenuContent) { + vfMegaMenuContent.setAttribute('aria-hidden', 'true'); + // Remove expanded state from any active menu items + const expandedLinks = document.querySelectorAll('.vf-mega-menu__link.is-expanded'); + expandedLinks.forEach(link => link.click()); + } + }, [location]); // Dependency on location triggers this effect on route changes + + return children; +} + +function App() { + return ( + + +
+ + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + +