Skip to content

Commit

Permalink
docs: add missing class selectors (#6624)
Browse files Browse the repository at this point in the history
  • Loading branch information
aliemir authored Jan 2, 2025
1 parent 74ed9a3 commit 260b9d9
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 21 deletions.
9 changes: 8 additions & 1 deletion documentation/src/components/browser-window/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ export default function BrowserWindow({
hasBottom = false,
}: Props): JSX.Element {
return (
<div className={clsx("flex", "flex-col", "h-full")}>
<div
className={clsx(
"refine-live-preview-browser-window",
"flex",
"flex-col",
"h-full",
)}
>
<div
className={clsx(
"flex-shrink-0",
Expand Down
2 changes: 1 addition & 1 deletion documentation/src/components/codesandbox-example/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const CodeSandboxExample: React.FC<Props> = ({
const EDITOR_URL = `${CODESANDBOX_URL}?view=preview&theme=dark&runonclick=1&codemirror=1`;

return (
<div>
<div className="refine-codesandbox-example">
{!hideSource && <ExampleSourcePrompt path={path} />}
{!hideLocal && <ExampleLocalPrompt path={path} />}
{!hideSandbox && (
Expand Down
10 changes: 9 additions & 1 deletion documentation/src/components/live-preview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ function Editor({ hidden, code }: { hidden: boolean; code: string }) {
<button
type="button"
className={clsx(
"refine-live-preview-editor-toggle-button",
"w-full",
"focus:outline-none",
"appearance-none",
Expand Down Expand Up @@ -265,7 +266,14 @@ const LivePreviewBase = ({
const { isLast } = useDocsVersion();

return (
<div className={clsx("overflow-hidden", "mb-6", "refine-wider-container")}>
<div
className={clsx(
"refine-live-preview",
"overflow-hidden",
"mb-6",
"refine-wider-container",
)}
>
<>
<BrowserWindow url={url} hasBottom={!previewOnly}>
<div
Expand Down
60 changes: 44 additions & 16 deletions documentation/src/components/sandpack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { DragHandle } from "./drag-handle";
import { useResizable } from "./use-resizable";

type Props = React.ComponentProps<SandpackInternal> & {
files: SandpackFiles;
startRoute?: string;
showOpenInCodeSandbox?: boolean;
showNavigator?: boolean;
Expand Down Expand Up @@ -204,7 +205,9 @@ const SandpackBase = ({

return (
<>
<div className={clsx("pb-6", wrapperClassName)}>
<div
className={clsx("pb-6", "refine-sandpack-wrapper", wrapperClassName)}
>
<div
className={clsx(
"absolute",
Expand Down Expand Up @@ -387,25 +390,50 @@ const SandpackBase = ({
/>
<div className={clsx(showConsole ? "block" : "hidden", "h-[200px]")} />
</div>
<section className="hidden max-w-0 max-h-0">
<h6>Code Example</h6>
<p>{`Dependencies: ${Object.keys(dependencies ?? {}).map(
(k) => `${k}@${dependencies[k]}`,
)}`}</p>
<div>{"Code Files"}</div>
{Object.keys(files ?? {}).map((f) => (
<div key={f}>
<div>{`File: ${f}`}</div>
<pre>
{`Content: ${"code" in files[f] ? files[f].code : files[f]}`}
</pre>
</div>
))}
</section>
<SandpackHiddenSnapshot files={files} dependencies={dependencies} />
</>
);
};

const SandpackHiddenSnapshot = ({
files,
dependencies,
}: { files: SandpackFiles; dependencies: Record<string, string> }) => {
const dependencyList = (
<p>{`Dependencies: ${Object.keys(dependencies ?? {})
.map((k) => `${k}@${dependencies[k]}`)
.join(", ")}`}</p>
);

const visibleFiles = Object.keys(files ?? {}).filter(
(f) =>
typeof files[f] === "string" ||
(typeof files[f] === "object" && files[f].hidden !== true),
);

return (
<section className="hidden max-w-0 max-h-0">
<h6>Code Example</h6>
{/* {dependencyList} */}
<div>{"Code Files"}</div>
{visibleFiles.map((f) => (
<div key={f}>
<div>{`File: ${f}`}</div>
<div>Content:</div>
<pre>{getFileContent(files[f])}</pre>
</div>
))}
</section>
);
};

const getFileContent = (file: SandpackFiles[string]) => {
if (typeof file === "string") {
return file;
}
return "code" in file ? file.code : "";
};

const SandpackNextJS = (props: Props) => {
const isDevelop = process.env.NODE_ENV === "development";

Expand Down
4 changes: 2 additions & 2 deletions documentation/src/components/tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ const Tooltip: FC<PropsWithChildren<Props>> = ({ label, children }) => {
if (!label) return <>{children}</>;

return (
<div className={`${styles.tooltip} group/prop-tooltip`}>
<div className={`refine-tooltip ${styles.tooltip} group/prop-tooltip`}>
{children}
<div
className={`${styles.tooltipContainer} group-hover/prop-tooltip:visible`}
className={`refine-tooltip-content ${styles.tooltipContainer} group-hover/prop-tooltip:visible`}
>
<span className={styles.tooltipContent}>{label}</span>
<div className={styles.tooltipArrow} />
Expand Down
1 change: 1 addition & 0 deletions documentation/src/refine-theme/common-copy-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const CommonCopyButton = ({ code, className }) => {
aria-label={isCopied ? "Copied!" : "Copy code to clipboard"}
title={"Copy code to clipboard"}
className={clsx(
"refine-code-block-copy-button",
"w-6 h-6",
"flex justify-center items-center",
"bg-gray-200",
Expand Down
1 change: 1 addition & 0 deletions documentation/src/refine-theme/common-wordwrap-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const CommonWordWrapButton = ({ onClick, isEnabled }) => {
type="button"
onClick={() => onClick()}
className={clsx(
"refine-code-block-word-wrap-button",
"w-6 h-6",
"flex justify-center items-center",
"bg-gray-200",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const DocThumbsUpDownFeedbackWidget = (
{props.children}
<div
className={clsx(
"refine-feedback-widget",
"relative",
"z-popover",
"hidden md:flex",
Expand Down

0 comments on commit 260b9d9

Please sign in to comment.