-
Notifications
You must be signed in to change notification settings - Fork 0
Adds new component NoTableEntriesYet #5
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
3 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
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
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
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,19 @@ | ||
| import { memo } from "react"; | ||
| import { useDefaults } from "../hooks/useDefaults"; | ||
| import { NO_TABLE_ENTRIES_YET_DEFAULTS, NoTableEntriesYetProps } from "../types/noTableEntriesYet"; | ||
|
|
||
|
|
||
| function GetNoTableEntriesYet(_props: NoTableEntriesYetProps) { | ||
| const [props] = useDefaults<NoTableEntriesYetProps>(_props, NO_TABLE_ENTRIES_YET_DEFAULTS); | ||
|
|
||
| return <tr> | ||
| <td colSpan={props.tableColumns}> | ||
| <div className={`flex justify-center items-center w-full text-sm ${props.heightClass + " " + props.backgroundColorClass + " " + props.textColorClass + " " + props.marginBottomClass}`}> | ||
| {props.text} | ||
| </div> | ||
| </td> | ||
| </tr> | ||
|
|
||
| } | ||
|
|
||
| export const NoTableEntriesYet = memo(GetNoTableEntriesYet) | ||
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,46 @@ | ||
| /** | ||
| * Options for the InfoButton component | ||
| * @content {string | JSX.Element} - The content of the info button | ||
| * @infoButtonSize {"xs" | "sm" | "md" | "lg", optional} - The size of the info icon used as button | ||
| * @infoButtonColorClass {string, optional} - The color of the info icon used as button | ||
| * @access {"hover" | "click", optional} - How to access the info content | ||
| * @display {"absoluteDiv" | "modal"} - The display of the info button | ||
| * @divPosition {"top" | "bottom" | "left" | "right", optional} - The position of the info div - only used if display is absoluteDiv | ||
| * @divZIndexClass {string, optional} - The z-index of the info div - only used if display is absoluteDiv | ||
| */ | ||
|
|
||
| export type InfoButtonProps = { | ||
| content: string | JSX.Element; | ||
| infoButtonSize?: "xs" | "sm" | "md" | "lg"; | ||
| infoButtonColorClass?: string; | ||
| access?: "hover" | "click"; | ||
| display?: "absoluteDiv" | "modal" | ||
| divPosition?: "top" | "bottom" | "left" | "right"; | ||
| divZIndexClass?: string; | ||
| } | ||
|
|
||
| /** | ||
| * Return type of the InfoButton helper function | ||
| * @size {number} - The size of the info icon used as button | ||
| * @cursorClass {string} - The cursor of the info icon used as button | ||
| * @positionClass {string} - The position of the info div - only used if display is absoluteDiv | ||
| * @hideInfo {function} - The function that will be called when the info div should be hidden | ||
| * @showInfo {function} - The function that will be called when the info div should be shown | ||
| */ | ||
|
|
||
| export type InfoButtonConfig = { | ||
| size: number; | ||
| cursorClass: string; | ||
| positionClass: string; | ||
| hideInfo: () => void; | ||
| showInfo: () => void; | ||
| } | ||
|
|
||
|
|
||
| export const INFO_BUTTON_DEFAULT_VALUES = { | ||
| size: "sm", | ||
| access: "hover", | ||
| display: "absoluteDiv", | ||
| divPosition: "top", | ||
| divZIndexClass: "z-10" | ||
| } |
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,29 @@ | ||
|
|
||
| import { CompareOptions } from "@/submodules/javascript-functions/validations"; | ||
|
|
||
| /** | ||
| * Options for the LocalStorage Dropdown component | ||
| * Note that a ref object can be linked to the component | ||
| * @buttonName {string} - The name of the button | ||
| * @storageKey {string} - The key inside the storage group | ||
| * @storageGroupKey {string, optional} - The key of the local storage value (defaults to localDropdown) | ||
| * @onOptionSelected {function, optional} - The function that will be called when an option is selected | ||
| * @searchDefaultValue {string, optional} - The default value of the search bar (similar to buttonName) | ||
| * @excludedFromStorage {object, optional} - Decided what values are exempt from being added to the storage - defaults to "starting with 'select' or 'enter'" | ||
| */ | ||
|
|
||
| export type LocalStorageDropdownProps = { | ||
| buttonName: string; | ||
| storageKey: string; | ||
| storageGroupKey?: string; //defaults to localDropdown | ||
| onOptionSelected?: (option: string) => void; | ||
| searchDefaultValue?: string; | ||
| excludedFromStorage?: { values: string[]; compareOptions?: CompareOptions[] }; // if the value is in this list it will not be added to the storage //setting this to null will assume all values are valid | ||
| } | ||
|
|
||
|
|
||
|
|
||
| export const LOCAL_STORAGE_DROPDOWN_DEFAULTS = { | ||
| storageGroupKey: "localDropdown", | ||
| excludedFromStorage: { values: ["select", "enter"], compareOptions: [CompareOptions.IGNORE_CASE, CompareOptions.TRIM, CompareOptions.STARTS_WITH] } | ||
| } |
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,28 @@ | ||
|
|
||
| /** | ||
| * Options for the No table entries yet component | ||
| * @tableColumns {number} - The number of columns in the table (so the text can be across the whole table) | ||
| * @text {string, optional} - The text to be displayed | ||
| * @heightClass {string, optional} - The height of the component | ||
| * @backgroundColorClass {string, optional} - The background color of the component | ||
| * @textColorClass {string, optional} - The text color of the component | ||
| * @marginBottomClass {string, optional} - The margin bottom of the component | ||
| */ | ||
|
|
||
| export type NoTableEntriesYetProps = { | ||
| tableColumns: number; | ||
| text?: string; | ||
| heightClass?: string; | ||
| backgroundColorClass?: string; | ||
| textColorClass?: string; | ||
| marginBottomClass?: string; // can be used to offset common table paddings, usually negative | ||
| } | ||
|
|
||
|
|
||
| export const NO_TABLE_ENTRIES_YET_DEFAULTS = { | ||
| text: 'No data yet', | ||
| heightClass: 'h-16', | ||
| backgroundColorClass: 'bg-gray-50', | ||
| textColorClass: 'text-gray-700', | ||
| marginBottomClass: "", | ||
| } |
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.