Skip to content

Commit

Permalink
Merge pull request #6 from vtexdocs/fix/helpcenter-fixes
Browse files Browse the repository at this point in the history
Fix/helpcenter fixes
  • Loading branch information
aliceoq authored Nov 29, 2023
2 parents da57db3 + 8003cab commit 3dc6d16
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
1 change: 1 addition & 0 deletions dist/index.css

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

2 changes: 1 addition & 1 deletion dist/index.css.map

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

12 changes: 6 additions & 6 deletions dist/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7218,7 +7218,7 @@ var SidebarElements = ({ slugPrefix, items, subItemLevel }) => {
endpoint,
children
}) => {
const localizedName = typeof name === "string" ? name : name[`${locale}`];
const localizedName = typeof name === "string" ? name : name[locale];
const isExpandable = children.length > 0;
const pathSuffix = method ? `#${method.toLowerCase()}-${endpoint}` : "";
const activeItem = method ? `${slug}${pathSuffix}` : slug;
Expand Down Expand Up @@ -7267,7 +7267,7 @@ var SidebarElements = ({ slugPrefix, items, subItemLevel }) => {
}
) : checkDocumentationType(sidebarDataMaster, slug, "link") ? /* @__PURE__ */ jsxs12(Link3, { href: slug, target: "_blank", sx: styles_default11.elementText, children: [
/* @__PURE__ */ jsx17(IconExternalLink, { size: 16, sx: { marginRight: "10px" } }),
name
localizedName
] }) : /* @__PURE__ */ jsxs12(
Box10,
{
Expand Down Expand Up @@ -7444,7 +7444,8 @@ var SidebarSection = ({
isEditorPreview,
sidebarSectionHidden,
setSidebarSectionHidden,
sidebarSections
sidebarSections,
locale
} = useContext5(LibraryContext);
const [methodFilterList, setMethodFilterList] = useState6([
{ name: "POST", active: false },
Expand All @@ -7456,7 +7457,6 @@ var SidebarSection = ({
const filterStatus = methodFilterList.some(
(methodFilter) => methodFilter.active
);
const { locale } = useContext5(LibraryContext);
const filteredResult = useMemo(() => {
if (!filterStatus && searchValue === "")
return categories;
Expand All @@ -7467,12 +7467,12 @@ var SidebarSection = ({
const hasMethodFilter = !filterStatus || methodFilterList.find(
(methodFilter) => methodFilter.name === endpoint.method
)?.active;
const hasInputFilter = searchValue === "" || endpoint.name.toLowerCase().includes(searchValue.toLowerCase());
const hasInputFilter = searchValue === "" || (typeof endpoint.name === "string" ? endpoint.name : endpoint.name[locale]).toLowerCase().includes(searchValue.toLowerCase());
return hasMethodFilter && hasInputFilter;
});
return subcategory;
}).filter(
(subcategory) => subcategory.children.length > 0 || subcategory.type === "markdown" && subcategory.name.toLowerCase().includes(searchValue.toLowerCase())
(subcategory) => subcategory.children.length > 0 || subcategory.type === "markdown" && (typeof subcategory.name === "string" ? subcategory.name : subcategory.name[locale]).toLowerCase().includes(searchValue.toLowerCase())
);
return category2;
}).filter((category2) => category2.children.length > 0);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.mjs.map

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions src/components/sidebar-elements/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { MethodType } from 'utils/typings/types'
import { LibraryContext } from 'utils/context/libraryContext'

export interface SidebarElement {
name: string
name: string | { en: string; pt: string; es: string }
slug: string
origin: string
type: string
Expand Down Expand Up @@ -108,8 +108,7 @@ const SidebarElements = ({ slugPrefix, items, subItemLevel }: SidebarProps) => {
endpoint,
children,
}: SidebarElement) => {
const localizedName: string =
typeof name === 'string' ? name : name[`${locale}`]
const localizedName: string = typeof name === 'string' ? name : name[locale]
const isExpandable = children.length > 0
const pathSuffix = method ? `#${method.toLowerCase()}-${endpoint}` : ''
const activeItem = method ? `${slug}${pathSuffix}` : slug
Expand Down Expand Up @@ -170,7 +169,7 @@ const SidebarElements = ({ slugPrefix, items, subItemLevel }: SidebarProps) => {
) : checkDocumentationType(sidebarDataMaster, slug, 'link') ? (
<Link href={slug} target="_blank" sx={styles.elementText}>
<IconExternalLink size={16} sx={{ marginRight: '10px' }} />
{name}
{localizedName}
</Link>
) : (
<Box
Expand Down
15 changes: 11 additions & 4 deletions src/components/sidebar-section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const SidebarSection = ({
sidebarSectionHidden,
setSidebarSectionHidden,
sidebarSections,
locale,
} = useContext(LibraryContext)
const [methodFilterList, setMethodFilterList] = useState([
{ name: 'POST', active: false },
Expand All @@ -44,8 +45,6 @@ const SidebarSection = ({
(methodFilter) => methodFilter.active
)

const { locale } = useContext(LibraryContext)

const filteredResult = useMemo(() => {
if (!filterStatus && searchValue === '') return categories

Expand All @@ -63,7 +62,12 @@ const SidebarSection = ({
)?.active
const hasInputFilter =
searchValue === '' ||
endpoint.name.toLowerCase().includes(searchValue.toLowerCase())
(typeof endpoint.name === 'string'
? endpoint.name
: endpoint.name[locale]
)
.toLowerCase()
.includes(searchValue.toLowerCase())
return hasMethodFilter && hasInputFilter
})
return subcategory
Expand All @@ -72,7 +76,10 @@ const SidebarSection = ({
(subcategory) =>
subcategory.children.length > 0 ||
(subcategory.type === 'markdown' &&
subcategory.name
(typeof subcategory.name === 'string'
? subcategory.name
: subcategory.name[locale]
)
.toLowerCase()
.includes(searchValue.toLowerCase()))
)
Expand Down
1 change: 1 addition & 0 deletions src/lib/markdown-renderer/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ table .code {
border: 1px solid #ccced8;
grid-template-columns: 20px 1fr;
grid-template-rows: 1fr;
word-break: break-all;
}

.blockquote p{
Expand Down

0 comments on commit 3dc6d16

Please sign in to comment.