Skip to content
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

fix(Nav): remove nav tabs when variant bs-tabs not defined #279

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 28 additions & 20 deletions cypress/apps/cra/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cypress/apps/cra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"homepage": "https://govtechsg.github.io/sgds-govtech-react/",
"dependencies": {
"@govtechsg/sgds": "^2.1.1",
"@govtechsg/sgds": "^2.3.5",
"@govtechsg/sgds-react": "file:../../../dist",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
Expand Down
4 changes: 4 additions & 0 deletions cypress/apps/cra/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ import {
ToastCom,
TooltipCom,
} from './components';
import { Nav } from '@govtechsg/sgds-react';

function App() {
return (
<div className="container">
<NavCom />
<Nav>
<Nav.Link href="#">test</Nav.Link>
</Nav>
<SideNavCom />
<AccordionCom />
<AlertCom />
Expand Down
98 changes: 57 additions & 41 deletions cypress/apps/cra/src/index.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// Configuration

@import '@govtechsg/sgds/sass/functions';
@import '@govtechsg/sgds/sass/variables';
@import '@govtechsg/sgds/sass/mixins';
@import '@govtechsg/sgds/sass/utilities';
$enable-cssgrid: true;
$primary: #3fb247;
$progress-bar-bg: $primary;
// $sidenav-color: #3fb247;
$primarys: (
'primary-100': #52e85c,
'primary-200': #4dd956,
Expand All @@ -18,42 +12,64 @@ $primarys: (
'primary-800': #0f2b11,
'primary-900': #020502,
);
$custom-secondarys: (
'primary-100': rgb(170, 170, 235),
'primary-200': rgb(111, 111, 241),
'primary-300': rgb(91, 91, 239),
'primary-400': rgb(42, 42, 216),
'primary-500': blue,
'primary-600': rgb(14, 14, 192),
'primary-700': rgb(9, 9, 104),
'primary-800': rgb(1, 1, 44),
'primary-900': rgb(0, 0, 4),
);
// $accordion-button-active-color: red;
// @import '@govtechsg/sgds/sass/sgds';
// @import '@govtechsg/sgds/sass/functions';
// @import '@govtechsg/sgds/sass/variables';
// @import '@govtechsg/sgds/sass/mixins';
// @import '@govtechsg/sgds/sass/maps';
// @import '@govtechsg/sgds/sass/utilities';
$enable-cssgrid: true;
// $primary: #3fb247;
// // $sidenav-color: #3fb247;
// $progress-bar-bg: $primary;
// $primarys: (
// 'primary-100': #52e85c,
// 'primary-200': #4dd956,
// 'primary-300': #39a340,
// 'primary-400': #3ba442,
// 'primary-500': #3fb247,
// 'primary-600': #308636,
// 'primary-700': #1b4a1e,
// 'primary-800': #0f2b11,
// 'primary-900': #020502,
// );
// $custom-secondarys: (
// 'primary-100': rgb(170, 170, 235),
// 'primary-200': rgb(111, 111, 241),
// 'primary-300': rgb(91, 91, 239),
// 'primary-400': rgb(42, 42, 216),
// 'primary-500': blue,
// 'primary-600': rgb(14, 14, 192),
// 'primary-700': rgb(9, 9, 104),
// 'primary-800': rgb(1, 1, 44),
// 'primary-900': rgb(0, 0, 4),
// );

$secondarys: map-merge($secondarys, $custom-secondarys);
// $secondarys: map-merge($secondarys, $custom-secondarys);

$theme-colors: map-merge(
$theme-colors,
(
'primary': $primary,
)
);
$theme-colors-rgb: map-loop($theme-colors, to-rgb, '$value');
$theme-colors-set: map-merge(
$theme-colors-set,
(
'primary': $primarys,
'secondary': $secondarys,
)
);
// $theme-colors: map-merge(
// $theme-colors,
// (
// 'primary': $primary,
// )
// );
// $theme-colors-rgb: map-loop($theme-colors, to-rgb, '$value');
// $theme-colors-set: map-merge(
// $theme-colors-set,
// (
// 'primary': $primarys,
// 'secondary': $secondarys,
// )
// );

$utilities-colors: map-merge($utilities-colors, $theme-colors-rgb);
$utilities-text-colors: map-loop(
$utilities-colors,
rgba-css-var,
'$key',
'text'
);
$utilities-bg-colors: map-loop($utilities-colors, rgba-css-var, '$key', 'bg');
// $utilities-colors: map-merge($utilities-colors, $theme-colors-rgb);
// $utilities-text-colors: map-loop(
// $utilities-colors,
// rgba-css-var,
// '$key',
// 'text'
// );
// $utilities-bg-colors: map-loop($utilities-colors, rgba-css-var, '$key', 'bg');

@import '@govtechsg/sgds/sass/sgds';
48 changes: 28 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@babel/core": "^7.16.5",
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@govtechsg/sgds": "latest",
"@govtechsg/sgds": "^2.3.5",
"@govtechsg/sgds-web-component": "^1.2.2",
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-node-resolve": "^13.1.3",
Expand Down
8 changes: 4 additions & 4 deletions src/Nav/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import {

export interface NavProps extends BsPrefixProps, BaseNavProps {
/**
* The visual variant of the nav items.
* The visual variant of the nav items. Used in 'Tabs component. To enable bootstrap default nav tabs use 'bs-tabs'
*/
variant?: 'tabs-basic-toggle' | 'tabs-info-toggle';
variant?: 'tabs-basic-toggle' | 'tabs-info-toggle' | 'bs-tabs';
/**
* Enable vertical scrolling within the toggleable contents of a collapsed Navbar.
*/
Expand All @@ -46,7 +46,7 @@ const propTypes = {
/**
* The visual variant of the nav items.
*
* @type {('tabs-basic-toggle' | 'tabs-info-toggle')}
* @type {('tabs-basic-toggle' | 'tabs-info-toggle' | 'bs-tabs')}
*/
variant: PropTypes.string,

Expand Down Expand Up @@ -134,7 +134,7 @@ const Nav: BsPrefixRefForwardingComponent<'ul', NavProps> = React.forwardRef<
[`${navbarContext?.bsPrefix}-nav-scroll`]:
navbarContext && navbarScroll,
['sgds']: !navbarContext,
['nav-tabs']: !navbarContext,
['nav-tabs']: props.variant === 'bs-tabs',
})}
{...props}
/>
Expand Down
Loading