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

chore: update console info #1125

Merged
merged 1 commit into from
Aug 29, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/components/chart-elements/AreaChart/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)

if (process.env.NODE_ENV === "development") {
console.info(
"The AreaChart is also available as a copy-and-paste component. Visit https://tremor.so/docs/visualizations/area-chart",
"The AreaChart is also available as a copy-and-paste component. Visit https://tremor.so/docs/visualizations/area-chart (This is only shown in development)",
);
}
return (
Expand Down
6 changes: 5 additions & 1 deletion src/components/chart-elements/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
setActiveBar(undefined);
}
const yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);

if (process.env.NODE_ENV === "development") {
console.info(
"The BarChart is also available as a copy-and-paste component. Visit https://tremor.so/docs/visualizations/bar-chart (This is only shown in development)",
);
}
return (
<div ref={ref} className={tremorTwMerge("w-full h-80", className)} {...other}>
<ResponsiveContainer className="h-full w-full">
Expand Down
6 changes: 6 additions & 0 deletions src/components/chart-elements/DonutChart/DonutChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ const DonutChart = React.forwardRef<HTMLDivElement, DonutChartProps>((props, ref
}
}, [activeIndex]);

if (process.env.NODE_ENV === "development") {
console.info(
"The DonutChart is also available as a copy-and-paste component. Visit https://tremor.so/docs/visualizations/donut-chart (This is only shown in development)",
);
}

return (
<div ref={ref} className={tremorTwMerge("w-full h-40", className)} {...other}>
<ResponsiveContainer className="h-full w-full">
Expand Down
6 changes: 6 additions & 0 deletions src/components/chart-elements/LineChart/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
setActiveDot(undefined);
}

if (process.env.NODE_ENV === "development") {
console.info(
"The LineChart is also available as a copy-and-paste component. Visit https://tremor.so/docs/visualizations/line-chart (This is only shown in development)",
);
}

return (
<div ref={ref} className={tremorTwMerge("w-full h-80", className)} {...other}>
<ResponsiveContainer className="h-full w-full">
Expand Down
6 changes: 6 additions & 0 deletions src/components/icon-elements/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>((props, ref) => {

const { tooltipProps, getReferenceProps } = useTooltip();

if (process.env.NODE_ENV === "development") {
console.info(
"The Badge is also available as a copy-and-paste component. Visit https://tremor.so/docs/ui/badge (This is only shown in development)",
);
}

return (
<span
ref={mergeRefs([ref, tooltipProps.refs.setReference])}
Expand Down
6 changes: 6 additions & 0 deletions src/components/input-elements/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) =>
toggleTransition(loading);
}, [loading]);

if (process.env.NODE_ENV === "development") {
console.info(
"The Button is also available as a copy-and-paste component. Visit https://tremor.so/docs/ui/button (This is only shown in development)",
);
}

return (
// eslint-disable-next-line react/button-has-type
<button
Expand Down
5 changes: 5 additions & 0 deletions src/components/input-elements/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ function Calendar<T extends DayPickerSingleProps | DayPickerRangeProps>({
weekStartsOn = 0,
...other
}: T & { enableYearNavigation: boolean }) {
if (process.env.NODE_ENV === "development") {
console.info(
"The Calendar is also available as a copy-and-paste component. Visit https://tremor.so/docs/inputs/calendar (This is only shown in development)",
);
}
return (
<DayPicker
showOutsideDays={true}
Expand Down
6 changes: 6 additions & 0 deletions src/components/input-elements/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ const DatePicker = React.forwardRef<HTMLDivElement, DatePickerProps>((props, ref
setSelectedValue(undefined);
};

if (process.env.NODE_ENV === "development") {
console.info(
"The DatePicker is also available as a copy-and-paste component. Visit https://tremor.so/docs/inputs/date-picker (This is only shown in development)",
);
}

return (
<Popover
ref={ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ const DateRangePicker = React.forwardRef<HTMLDivElement, DateRangePickerProps>((
setSelectedValue({});
};

if (process.env.NODE_ENV === "development") {
console.info(
"The DateRangePicker is also available as a copy-and-paste component. Visit https://tremor.so/docs/inputs/date-range-picker (This is only shown in development)",
);
}

return (
<div
ref={ref}
Expand Down
6 changes: 6 additions & 0 deletions src/components/input-elements/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ const Select = React.forwardRef<HTMLInputElement, SelectProps>((props, ref) => {
onValueChange?.("");
};

if (process.env.NODE_ENV === "development") {
console.info(
"The Select is also available as a copy-and-paste component. Visit https://tremor.so/docs/inputs/select (This is only shown in development)",
);
}

return (
<div
className={tremorTwMerge(
Expand Down
6 changes: 6 additions & 0 deletions src/components/input-elements/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ const Switch = React.forwardRef<HTMLDivElement, SwitchProps>((props, ref) => {
const delay = 300;
const { tooltipProps, getReferenceProps } = useTooltip(delay);

if (process.env.NODE_ENV === "development") {
console.info(
"The Switch is also available as a copy-and-paste component. Visit https://tremor.so/docs/inputs/switch (This is only shown in development)",
);
}

return (
<div className="flex flex-row items-center justify-start">
<Tooltip text={tooltip} {...tooltipProps} />
Expand Down
6 changes: 5 additions & 1 deletion src/components/input-elements/Tabs/TabGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export interface TabGroupProps extends React.HTMLAttributes<HTMLDivElement> {

const TabGroup = React.forwardRef<HTMLDivElement, TabGroupProps>((props, ref) => {
const { defaultIndex, index, onIndexChange, children, className, ...other } = props;

if (process.env.NODE_ENV === "development") {
console.info(
"The Tab is also available as a copy-and-paste component. Visit https://tremor.so/docs/ui/tabs (This is only shown in development)",
);
}
return (
<Tab.Group
as="div"
Expand Down
5 changes: 5 additions & 0 deletions src/components/input-elements/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ const makeTextInputClassName = makeClassName("TextInput");

const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>((props, ref) => {
const { type = "text", ...other } = props;
if (process.env.NODE_ENV === "development") {
console.info(
"The TextInput is also available as a copy-and-paste component. Visit https://tremor.so/docs/inputs/input (This is only shown in development)",
);
}
return <BaseInput ref={ref} type={type} makeInputClassName={makeTextInputClassName} {...other} />;
});

Expand Down
6 changes: 5 additions & 1 deletion src/components/input-elements/Textarea/Textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>((props, re
textAreaHTMLRef.style.height = scrollHeight + "px";
}
}, [autoHeight, inputRef, val]);

if (process.env.NODE_ENV === "development") {
console.info(
"The Textarea is also available as a copy-and-paste component. Visit https://tremor.so/docs/inputs/textarea (This is only shown in development)",
);
}
return (
<>
<textarea
Expand Down
6 changes: 5 additions & 1 deletion src/components/layout-elements/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ const Accordion = React.forwardRef<HTMLDivElement, AccordionProps>((props, ref)

const rootStyles =
useContext(RootStylesContext) ?? tremorTwMerge("rounded-tremor-default border");

if (process.env.NODE_ENV === "development") {
console.info(
"The Accordion is also available as a copy-and-paste component. Visit https://tremor.so/docs/ui/accordion (This is only shown in development)",
);
}
return (
<Disclosure
as="div"
Expand Down
5 changes: 5 additions & 0 deletions src/components/layout-elements/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {

const Card = React.forwardRef<HTMLDivElement, CardProps>((props, ref) => {
const { decoration = "", decorationColor, children, className, ...other } = props;
if (process.env.NODE_ENV === "development") {
console.info(
"The Card is also available as a copy-and-paste component. Visit https://tremor.so/docs/ui/card (This is only shown in development)",
);
}
return (
<div
ref={ref}
Expand Down
5 changes: 5 additions & 0 deletions src/components/layout-elements/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export type DialogProps = React.HTMLAttributes<HTMLDivElement> & {

const Dialog = React.forwardRef<HTMLDivElement, DialogProps>((props, ref) => {
const { children, className, ...other } = props;
if (process.env.NODE_ENV === "development") {
console.info(
"The Dialog is also available as a copy-and-paste component. Visit https://tremor.so/docs/ui/dialog (This is only shown in development)",
);
}
return (
<Transition as={React.Fragment} appear show={props.open}>
<HeadlessuiDialog
Expand Down
5 changes: 5 additions & 0 deletions src/components/layout-elements/Divider/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ const makeDividerClassName = makeClassName("Divider");
const Divider = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
(props, ref) => {
const { className, children, ...other } = props;
if (process.env.NODE_ENV === "development") {
console.info(
"The Divider is also available as a copy-and-paste component. Visit https://tremor.so/docs/ui/divider (This is only shown in development)",
);
}
return (
<div
ref={ref}
Expand Down
5 changes: 5 additions & 0 deletions src/components/list-elements/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ const makeTableClassName = makeClassName("Table");
const Table = React.forwardRef<HTMLTableElement, React.TableHTMLAttributes<HTMLTableElement>>(
(props, ref) => {
const { children, className, ...other } = props;
if (process.env.NODE_ENV === "development") {
console.info(
"The Table is also available as a copy-and-paste component. Visit https://tremor.so/docs/ui/table (This is only shown in development)",
);
}

return (
<div className={tremorTwMerge(makeTableClassName("root"), "overflow-auto", className)}>
Expand Down
6 changes: 5 additions & 1 deletion src/components/text-elements/Callout/Callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export interface CalloutProps extends React.HTMLAttributes<HTMLDivElement> {

const Callout = React.forwardRef<HTMLDivElement, CalloutProps>((props, ref) => {
const { title, icon, color, className, children, ...other } = props;

if (process.env.NODE_ENV === "development") {
console.info(
"The Callout is also available as a copy-and-paste component. Visit https://tremor.so/docs/ui/callout (This is only shown in development)",
);
}
const Icon = icon;
return (
<div
Expand Down
5 changes: 5 additions & 0 deletions src/components/util-elements/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ export interface TooltipProps {
}

const Tooltip = ({ text, open, x, y, refs, strategy, getFloatingProps }: TooltipProps) => {
if (process.env.NODE_ENV === "development") {
console.info(
"The Tooltip is also available as a copy-and-paste component. Visit https://tremor.so/docs/ui/tooltip (This is only shown in development)",
);
}
return open && text ? (
<div
className={tremorTwMerge(
Expand Down
5 changes: 5 additions & 0 deletions src/components/vis-elements/BarList/BarList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ function BarListInner<T>(props: BarListProps<T>, ref: React.ForwardedRef<HTMLDiv
}, [sortedData]);

const rowHeight = "h-8";
if (process.env.NODE_ENV === "development") {
console.info(
"The BarList is also available as a copy-and-paste component. Visit https://tremor.so/docs/visualizations/barlist (This is only shown in development)",
);
}

return (
<div
Expand Down
Loading