-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(design): add sidebar mode helpers (#3015)
- Loading branch information
Showing
5 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,21 @@ | ||
import { DaffSidebarModeEnum } from '@daffodil/design/sidebar'; | ||
|
||
import { daffSidebarIsDockedMode } from './is-docked-mode'; | ||
|
||
describe('@daffodil/design/sidebar | daffSidebarIsDockedMode', () => { | ||
it('should be true for side', () => { | ||
expect(daffSidebarIsDockedMode(DaffSidebarModeEnum.Side)).toBeTrue(); | ||
}); | ||
|
||
it('should be true for side fixed', () => { | ||
expect(daffSidebarIsDockedMode(DaffSidebarModeEnum.SideFixed)).toBeTrue(); | ||
}); | ||
|
||
it('should be false for under', () => { | ||
expect(daffSidebarIsDockedMode(DaffSidebarModeEnum.Under)).toBeFalse(); | ||
}); | ||
|
||
it('should be false for over', () => { | ||
expect(daffSidebarIsDockedMode(DaffSidebarModeEnum.Over)).toBeFalse(); | ||
}); | ||
}); |
This file contains 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 @@ | ||
import { DaffSidebarModeEnum } from './sidebar-mode'; | ||
|
||
const DOCKED_MODES = [ | ||
DaffSidebarModeEnum.Side, | ||
DaffSidebarModeEnum.SideFixed, | ||
]; | ||
|
||
/** | ||
* Returns whether the passed mode is a docked mode, i.e. side or side-fixed. | ||
*/ | ||
export const daffSidebarIsDockedMode = (mode: DaffSidebarModeEnum): boolean => DOCKED_MODES.includes(mode); |
This file contains 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,21 @@ | ||
import { DaffSidebarModeEnum } from '@daffodil/design/sidebar'; | ||
|
||
import { daffSidebarIsFloatingMode } from './is-floating-mode'; | ||
|
||
describe('@daffodil/design/sidebar | daffSidebarIsFloatingMode', () => { | ||
it('should be false for side', () => { | ||
expect(daffSidebarIsFloatingMode(DaffSidebarModeEnum.Side)).toBeFalse(); | ||
}); | ||
|
||
it('should be false for side fixed', () => { | ||
expect(daffSidebarIsFloatingMode(DaffSidebarModeEnum.SideFixed)).toBeFalse(); | ||
}); | ||
|
||
it('should be true for under', () => { | ||
expect(daffSidebarIsFloatingMode(DaffSidebarModeEnum.Under)).toBeTrue(); | ||
}); | ||
|
||
it('should be true for over', () => { | ||
expect(daffSidebarIsFloatingMode(DaffSidebarModeEnum.Over)).toBeTrue(); | ||
}); | ||
}); |
This file contains 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 @@ | ||
import { DaffSidebarModeEnum } from './sidebar-mode'; | ||
|
||
const FLOATING_MODES = [ | ||
DaffSidebarModeEnum.Under, | ||
DaffSidebarModeEnum.Over, | ||
]; | ||
|
||
/** | ||
* Returns whether the passed mode is a floating mode, i.e. under or over. | ||
*/ | ||
export const daffSidebarIsFloatingMode = (mode: DaffSidebarModeEnum): boolean => FLOATING_MODES.includes(mode); |
This file contains 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