-
Notifications
You must be signed in to change notification settings - Fork 6
Add Styling sample fo Switch #1012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
samples/inputs/switches/styling/.devcontainer/devcontainer.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "name": "Node.js", | ||
| "image": "mcr.microsoft.com/devcontainers/javascript-node:22" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| // https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project | ||
| module.exports = { | ||
| parser: "@typescript-eslint/parser", // Specifies the ESLint parser | ||
| parserOptions: { | ||
| ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features | ||
| sourceType: "module", // Allows for the use of imports | ||
| ecmaFeatures: { | ||
| jsx: true // Allows for the parsing of JSX | ||
| } | ||
| }, | ||
| settings: { | ||
| react: { | ||
| version: "999.999.999" // Tells eslint-plugin-react to automatically detect the version of React to use | ||
| } | ||
| }, | ||
| extends: [ | ||
| "eslint:recommended", | ||
| "plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react | ||
| "plugin:@typescript-eslint/recommended" // Uses the recommended rules from @typescript-eslint/eslint-plugin | ||
| ], | ||
| rules: { | ||
| // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs | ||
| "default-case": "off", | ||
| "no-undef": "off", | ||
| "no-unused-vars": "off", | ||
| "no-extend-native": "off", | ||
| "no-throw-literal": "off", | ||
| "no-useless-concat": "off", | ||
| "no-mixed-operators": "off", | ||
| "no-prototype-builtins": "off", | ||
| "prefer-const": "off", | ||
| "prefer-rest-params": "off", | ||
| "jsx-a11y/alt-text": "off", | ||
| "jsx-a11y/iframe-has-title": "off", | ||
| "@typescript-eslint/no-unused-vars": "off", | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
| "@typescript-eslint/no-inferrable-types": "off", | ||
| "@typescript-eslint/no-useless-constructor": "off", | ||
| "@typescript-eslint/no-use-before-define": "off", | ||
| "@typescript-eslint/no-non-null-assertion": "off", | ||
| "@typescript-eslint/interface-name-prefix": "off", | ||
| "@typescript-eslint/prefer-namespace-keyword": "off", | ||
| "@typescript-eslint/explicit-function-return-type": "off", | ||
| "@typescript-eslint/explicit-module-boundary-types": "off" | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| "files": ["*.ts", "*.tsx"], | ||
| "rules": { | ||
| "default-case": "off", | ||
| "no-undef": "off", | ||
| "no-unused-vars": "off", | ||
| "no-extend-native": "off", | ||
| "no-throw-literal": "off", | ||
| "no-useless-concat": "off", | ||
| "no-mixed-operators": "off", | ||
| "no-prototype-builtins": "off", | ||
| "prefer-const": "off", | ||
| "prefer-rest-params": "off", | ||
| "jsx-a11y/alt-text": "off", | ||
| "jsx-a11y/iframe-has-title": "off", | ||
| "@typescript-eslint/no-unused-vars": "off", | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
| "@typescript-eslint/no-inferrable-types": "off", | ||
| "@typescript-eslint/no-useless-constructor": "off", | ||
| "@typescript-eslint/no-use-before-define": "off", | ||
| "@typescript-eslint/no-non-null-assertion": "off", | ||
| "@typescript-eslint/interface-name-prefix": "off", | ||
| "@typescript-eslint/prefer-namespace-keyword": "off", | ||
| "@typescript-eslint/explicit-function-return-type": "off", | ||
| "@typescript-eslint/explicit-module-boundary-types": "off" | ||
| } | ||
| } | ||
| ] | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| <!-- NOTE: do not change this file because it's auto re-generated from template: --> | ||
| <!-- https://github.com/IgniteUI/igniteui-react-examples/tree/vnext/templates/sample/ReadMe.md --> | ||
|
|
||
| This folder contains implementation of React application with example of Styling feature using [Switches](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html) component. | ||
|
|
||
|
|
||
| <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | ||
| <body> | ||
| <a target="_blank" href="https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html" rel="noopener noreferrer"> | ||
| <img height="40px" style="border-radius: 0rem" alt="View Docs" src="https://dl.infragistics.com/x/img/browsers/button-docs.png"/> | ||
| </a> | ||
| <a target="_blank" href="./src/index.tsx" rel="noopener noreferrer"> | ||
| <img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="View Code" src="https://dl.infragistics.com/x/img/browsers/button-code.png"/> | ||
| </a> | ||
| <a target="_blank" href="https://www.infragistics.com/react-demos/samples/inputs/switches/styling" rel="noopener noreferrer"> | ||
| <img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-run.png"/> | ||
| </a> | ||
| <a target="_blank" href="https://codesandbox.io/s/github/IgniteUI/igniteui-react-examples/tree/master/samples/inputs/switches/styling?fontsize=14&hidenavigation=1&theme=dark&view=preview&file=/src/index.tsx" rel="noopener noreferrer"> | ||
| <img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-sandbox.png"/> | ||
| </a> | ||
| </body> | ||
| </html> | ||
|
|
||
| ## Branches | ||
|
|
||
| > **_NOTE:_** You should use [master](https://github.com/IgniteUI/igniteui-react-examples/tree/master) branch of this repository if you want to run samples on your computer. Use the [vnext](https://github.com/IgniteUI/igniteui-react-examples/tree/vnext) branch only when you want to contribute new samples to this repository. | ||
|
|
||
| ## Instructions | ||
|
|
||
| Follow these instructions to run this example: | ||
|
|
||
|
|
||
| ``` | ||
| git clone https://github.com/IgniteUI/igniteui-react-examples.git | ||
| git checkout master | ||
| cd ./igniteui-react-examples | ||
| cd ./samples/inputs/switches/styling | ||
| ``` | ||
|
|
||
| open above folder in VS Code or type: | ||
| ``` | ||
| code . | ||
| ``` | ||
|
|
||
| In terminal window, run: | ||
| ``` | ||
| npm install --legacy-peer-deps | ||
| npm run-script start | ||
| ``` | ||
|
|
||
| Then open http://localhost:4200/ in your browser | ||
|
|
||
|
|
||
| ## Learn More | ||
|
|
||
| To learn more about **Ignite UI for React** components, check out the [React documentation](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>SwitchChecking</title> | ||
| <link href="https://dl.infragistics.com/x/css/samples/shared.v8.css" rel="stylesheet" /> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/index.tsx"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "name": "react-switch-checking", | ||
| "description": "This project provides example of Switch Checking using Infragistics React components", | ||
| "author": "Infragistics", | ||
| "homepage": ".", | ||
| "version": "1.4.0", | ||
| "private": true, | ||
| "scripts": { | ||
| "start": "vite --port 4200", | ||
| "build": "tsc && node --max-old-space-size=4096 node_modules/vite/bin/vite build", | ||
| "preview": "vite preview", | ||
| "test": "vitest" | ||
| }, | ||
| "dependencies": { | ||
| "igniteui-dockmanager": "^1.17.0", | ||
| "igniteui-react": "^19.4.0", | ||
| "igniteui-react-core": "19.3.1", | ||
| "igniteui-webcomponents": "^6.3.0", | ||
| "react": "^19.2.0", | ||
| "react-dom": "^19.2.0", | ||
| "tslib": "^2.4.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/jest": "^29.2.0", | ||
| "@types/node": "^24.7.1", | ||
| "@types/react": "^18.0.24", | ||
| "@types/react-dom": "^18.0.8", | ||
| "@vitejs/plugin-react": "^5.0.4", | ||
| "@vitest/browser": "^3.2.4", | ||
| "typescript": "^4.8.4", | ||
| "vite": "^7.1.9", | ||
| "vitest": "^3.2.4", | ||
| "vitest-canvas-mock": "^0.3.3", | ||
| "worker-loader": "^3.0.8" | ||
| }, | ||
| "browserslist": [ | ||
| ">0.2%", | ||
| "not dead", | ||
| "not ie <= 11", | ||
| "not op_mini all" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "infiniteLoopProtection": false, | ||
| "hardReloadOnChange": false, | ||
| "view": "browser" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /* shared styles are loaded from: */ | ||
| /* https://dl.infragistics.com/x/css/samples/shared.v8.css */ | ||
|
|
||
| igc-switch { | ||
| --thumb-on-color: white; | ||
| --thumb-off-color: var(--ig-success-500); | ||
| --track-on-color: var(--ig-success-500); /* Background color when checked */ | ||
| --track-off-color: white; /* Background color when unchecked */ | ||
| --track-on-hover-color: var(--ig-success-500); /* Background hover color when checked */ | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import React from 'react'; | ||
| import ReactDOM from 'react-dom/client'; | ||
| import './index.css'; | ||
| import { IgrSwitch } from 'igniteui-react'; | ||
| import 'igniteui-webcomponents/themes/light/bootstrap.css'; | ||
|
|
||
| export default function SwitchStyling() { | ||
|
|
||
| return ( | ||
| <div className="container sample"> | ||
| <IgrSwitch checked={true} ><span>Label</span></IgrSwitch> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| // rendering above component to the React DOM | ||
| const root = ReactDOM.createRoot(document.getElementById('root')); | ||
| root.render(<SwitchStyling/>); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "resolveJsonModule": true, | ||
| "esModuleInterop": true, | ||
| "baseUrl": ".", | ||
| "outDir": "build/dist", | ||
| "module": "esnext", | ||
| "target": "es5", | ||
| "lib": [ | ||
| "es6", | ||
| "dom" | ||
| ], | ||
| "sourceMap": true, | ||
| "allowJs": true, | ||
| "jsx": "react", | ||
| "moduleResolution": "node", | ||
| "rootDir": "src", | ||
| "forceConsistentCasingInFileNames": true, | ||
| "noImplicitReturns": true, | ||
| "noImplicitThis": true, | ||
| "noImplicitAny": true, | ||
| "noUnusedLocals": false, | ||
| "importHelpers": true, | ||
| "allowSyntheticDefaultImports": true, | ||
| "skipLibCheck": true, | ||
| "strict": false, | ||
| "isolatedModules": true, | ||
| "noEmit": true | ||
| }, | ||
| "exclude": [ | ||
| "node_modules", | ||
| "build", | ||
| "scripts", | ||
| "acceptance-tests", | ||
| "webpack", | ||
| "jest", | ||
| "src/setupTests.ts", | ||
| "**/odatajs-4.0.0.js", | ||
| "config-overrides.js" | ||
| ], | ||
| "include": [ | ||
| "src" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { defineConfig } from 'vite'; | ||
| import react from '@vitejs/plugin-react'; | ||
|
|
||
| export default defineConfig({ | ||
| plugins: [react()], | ||
| build: { | ||
| outDir: 'build' | ||
| }, | ||
| server: { | ||
| open: false | ||
| }, | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.