fix: app store spacing issues (#6481)
* feat: add equal spacing with gap * fix: title style * fix: title style * fix: remove margin * fix: remove margin * fix: sub header spacing and slider button * fix: category card text * fix: app store spacing issues * fix: tab in tablet * fix: shell
This commit is contained in:
1 parent
b1af30e026
commit
34a61214d3
8 files changed
+75
-56
No files matched your search
@@ -4,18 +4,7 @@ import React, { ComponentProps } from "react";
|
||||
|
||||
import Shell from "@calcom/features/shell/Shell";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { EmptyScreen, Icon, HorizontalTabs, HorizontalTabItemProps } from "@calcom/ui";
|
||||
|
||||
const tabs: HorizontalTabItemProps[] = [
|
||||
{
|
||||
name: "app_store",
|
||||
href: "/apps",
|
||||
},
|
||||
{
|
||||
name: "installed_apps",
|
||||
href: "/apps/installed",
|
||||
},
|
||||
];
|
||||
import { EmptyScreen, Icon } from "@calcom/ui";
|
||||
|
||||
type AppsLayoutProps = {
|
||||
children: React.ReactNode;
|
||||
@@ -31,11 +20,8 @@ export default function AppsLayout({ children, actions, emptyStore, ...rest }: A
|
||||
if (session.status === "loading") return <></>;
|
||||
|
||||
return (
|
||||
<Shell {...rest} actions={actions?.("hidden sm:block")}>
|
||||
<Shell {...rest} actions={actions?.("block")}>
|
||||
<div className="flex flex-col xl:flex-row">
|
||||
<div className="block lg:hidden">
|
||||
<HorizontalTabs tabs={tabs} actions={actions?.("ml-6 mr-4 mt-3 block sm:hidden")} />
|
||||
</div>
|
||||
<main className="w-full">
|
||||
{emptyStore ? (
|
||||
<EmptyScreen
|
||||
|
||||
@@ -7,12 +7,31 @@ import { getSession } from "@calcom/lib/auth";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { AppCategories } from "@calcom/prisma/client";
|
||||
import { inferSSRProps } from "@calcom/types/inferSSRProps";
|
||||
import { AllApps, AppStoreCategories, Icon, TextField, TrendingAppsSlider } from "@calcom/ui";
|
||||
import {
|
||||
AllApps,
|
||||
AppStoreCategories,
|
||||
HorizontalTabItemProps,
|
||||
HorizontalTabs,
|
||||
Icon,
|
||||
TextField,
|
||||
TrendingAppsSlider,
|
||||
} from "@calcom/ui";
|
||||
|
||||
import AppsLayout from "@components/apps/layouts/AppsLayout";
|
||||
|
||||
import { ssgInit } from "@server/lib/ssg";
|
||||
|
||||
const tabs: HorizontalTabItemProps[] = [
|
||||
{
|
||||
name: "app_store",
|
||||
href: "/apps",
|
||||
},
|
||||
{
|
||||
name: "installed_apps",
|
||||
href: "/apps/installed",
|
||||
},
|
||||
];
|
||||
|
||||
function AppsSearch({
|
||||
onChange,
|
||||
className,
|
||||
@@ -43,20 +62,30 @@ export default function Apps({ categories, appStore }: inferSSRProps<typeof getS
|
||||
heading={t("app_store")}
|
||||
subtitle={t("app_store_description")}
|
||||
actions={(className) => (
|
||||
<AppsSearch className={className} onChange={(e) => setSearchText(e.target.value)} />
|
||||
<div className="flex w-full flex-col md:flex-row md:justify-between lg:w-auto">
|
||||
<div className="lg:hidden">
|
||||
<HorizontalTabs tabs={tabs} />
|
||||
</div>
|
||||
<div>
|
||||
<AppsSearch className={className} onChange={(e) => setSearchText(e.target.value)} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
headerClassName="sm:hidden lg:block hidden"
|
||||
emptyStore={!appStore.length}>
|
||||
{!searchText && (
|
||||
<>
|
||||
<AppStoreCategories categories={categories} />
|
||||
<TrendingAppsSlider items={appStore} />
|
||||
</>
|
||||
)}
|
||||
<AllApps
|
||||
apps={appStore}
|
||||
searchText={searchText}
|
||||
categories={categories.map((category) => category.name)}
|
||||
/>
|
||||
<div className="flex flex-col gap-y-8">
|
||||
{!searchText && (
|
||||
<>
|
||||
<AppStoreCategories categories={categories} />
|
||||
<TrendingAppsSlider items={appStore} />
|
||||
</>
|
||||
)}
|
||||
<AllApps
|
||||
apps={appStore}
|
||||
searchText={searchText}
|
||||
categories={categories.map((category) => category.name)}
|
||||
/>
|
||||
</div>
|
||||
</AppsLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,6 +148,7 @@ type LayoutProps = {
|
||||
title?: string;
|
||||
heading?: ReactNode;
|
||||
subtitle?: ReactNode;
|
||||
headerClassName?: string;
|
||||
children: ReactNode;
|
||||
CTA?: ReactNode;
|
||||
large?: boolean;
|
||||
@@ -784,15 +785,11 @@ export function ShellMain(props: LayoutProps) {
|
||||
/>
|
||||
)}
|
||||
{props.heading && (
|
||||
<header
|
||||
className={classNames(
|
||||
props.large && "py-8",
|
||||
"mb-4 flex w-full max-w-full items-center pt-4 md:p-0 lg:mb-10"
|
||||
)}>
|
||||
<header className={classNames(props.large && "py-8", " flex w-full max-w-full items-center")}>
|
||||
{props.HeadingLeftIcon && <div className="ltr:mr-4">{props.HeadingLeftIcon}</div>}
|
||||
<div className="w-full ltr:mr-4 rtl:ml-4 sm:block">
|
||||
<div className={classNames("w-full ltr:mr-4 rtl:ml-4 sm:block", props.headerClassName)}>
|
||||
{props.heading && (
|
||||
<h1 className="font-cal max-w-28 sm:max-w-72 md:max-w-80 mb-1 hidden truncate text-xl font-bold tracking-wide text-black sm:block xl:max-w-full">
|
||||
<h1 className="font-cal max-w-28 sm:max-w-72 md:max-w-80 mb-1 hidden truncate text-2xl font-semibold tracking-wide text-black sm:block xl:max-w-full">
|
||||
{!isLocaleReady ? <SkeletonText invisible /> : props.heading}
|
||||
</h1>
|
||||
)}
|
||||
@@ -815,7 +812,7 @@ export function ShellMain(props: LayoutProps) {
|
||||
</header>
|
||||
)}
|
||||
</div>
|
||||
<div className={classNames(props.flexChildrenContainer && "flex flex-1 flex-col")}>
|
||||
<div className={classNames(props.flexChildrenContainer && "flex flex-1 flex-col ", "pt-10")}>
|
||||
{props.children}
|
||||
</div>
|
||||
</>
|
||||
@@ -831,7 +828,7 @@ function MainContainer({
|
||||
<main className="relative z-0 flex-1 bg-white focus:outline-none">
|
||||
{/* show top navigation for md and smaller (tablet and phones) */}
|
||||
{TopNavContainerProp}
|
||||
<div className="max-w-full px-4 py-2 lg:py-8 lg:px-12">
|
||||
<div className="max-w-full px-4 py-8 lg:px-12">
|
||||
<ErrorBoundary>
|
||||
{!props.withoutMain ? <ShellMain {...props}>{props.children}</ShellMain> : props.children}
|
||||
</ErrorBoundary>
|
||||
|
||||
@@ -66,7 +66,7 @@ function CategoryTab({ selectedCategory, categories, searchText }: CategoryTabPr
|
||||
};
|
||||
return (
|
||||
<div className="relative mb-4 flex flex-col justify-between lg:flex-row lg:items-center">
|
||||
<h2 className="hidden text-lg font-semibold text-gray-900 sm:block">
|
||||
<h2 className="hidden text-base font-semibold leading-none text-gray-900 sm:block">
|
||||
{searchText
|
||||
? t("search")
|
||||
: t("explore_apps", {
|
||||
@@ -158,7 +158,7 @@ export function AllApps({ apps, searchText, categories }: AllAppsPropsType) {
|
||||
.filter((app) => (searchText ? app.name.toLowerCase().includes(searchText.toLowerCase()) : true));
|
||||
|
||||
return (
|
||||
<div className="mb-16">
|
||||
<div>
|
||||
<CategoryTab selectedCategory={selectedCategory} searchText={searchText} categories={categories} />
|
||||
{filteredApps.length ? (
|
||||
<div
|
||||
|
||||
@@ -39,7 +39,7 @@ export function AppCard({ app, credentials, searchText }: AppCardProps) {
|
||||
}, [app.name, searchText]);
|
||||
|
||||
return (
|
||||
<div className="relative flex h-64 flex-col rounded-md border border-gray-300 p-5">
|
||||
<div className="relative flex h-64 flex-col rounded-md border border-gray-200 p-5">
|
||||
<div className="flex">
|
||||
<img src={app.logo} alt={app.name + " Logo"} className="mb-4 h-12 w-12 rounded-sm" />
|
||||
</div>
|
||||
|
||||
@@ -15,9 +15,8 @@ export function AppStoreCategories({
|
||||
}) {
|
||||
const { t, isLocaleReady } = useLocale();
|
||||
return (
|
||||
<div className="mb-16">
|
||||
<div>
|
||||
<Slider
|
||||
className="mt-8 mb-16"
|
||||
title={t("featured_categories")}
|
||||
items={categories}
|
||||
itemKey={(category) => category.name}
|
||||
@@ -38,11 +37,11 @@ export function AppStoreCategories({
|
||||
style={{ background: "radial-gradient(farthest-side at top right, #a2abbe 0%, #E3E3E3 100%)" }}>
|
||||
<div className="w-full self-center bg-[url('/noise.svg')] bg-cover bg-center bg-no-repeat px-6 py-4">
|
||||
{isLocaleReady ? (
|
||||
<h3 className="font-medium capitalize">{category.name}</h3>
|
||||
<h3 className="text-sm font-semibold capitalize">{category.name}</h3>
|
||||
) : (
|
||||
<SkeletonText invisible />
|
||||
)}
|
||||
<p className="text-sm text-gray-500">
|
||||
<p className="pt-2 text-sm font-medium text-gray-500">
|
||||
{isLocaleReady ? t("number_apps", { count: category.count }) : <SkeletonText invisible />}{" "}
|
||||
<Icon.FiArrowRight className="inline-block h-4 w-4" />
|
||||
</p>
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
import Glide, { Options } from "@glidejs/glide";
|
||||
import "@glidejs/glide/dist/css/glide.core.min.css";
|
||||
import "@glidejs/glide/dist/css/glide.theme.min.css";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { ComponentProps, FC, useEffect, useRef } from "react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
|
||||
import { Icon } from "../../components/icon";
|
||||
import { SkeletonText } from "../skeleton";
|
||||
|
||||
const SliderButton: FC<ComponentProps<"button">> = (props) => {
|
||||
const { children, ...rest } = props;
|
||||
return (
|
||||
<button className="rounded p-2.5 text-gray-700 hover:bg-gray-100" {...rest}>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
export const Slider = <T extends string | unknown>({
|
||||
title = "",
|
||||
className = "",
|
||||
@@ -47,23 +56,23 @@ export const Slider = <T extends string | unknown>({
|
||||
`}
|
||||
</style>
|
||||
<div className="glide" ref={glide}>
|
||||
<div className="flex cursor-default">
|
||||
<div className="flex cursor-default pb-3">
|
||||
{isLocaleReady ? (
|
||||
title && (
|
||||
<div>
|
||||
<h2 className="mt-0 mb-2 text-lg font-semibold text-gray-900">{title}</h2>
|
||||
<h2 className="mt-0 mb-2 text-base font-semibold leading-none text-gray-900">{title}</h2>
|
||||
</div>
|
||||
)
|
||||
) : (
|
||||
<SkeletonText className="h-4 w-24" />
|
||||
)}
|
||||
<div className="glide__arrows ml-auto" data-glide-el="controls">
|
||||
<button data-glide-dir="<" className="mr-4">
|
||||
<Icon.FiArrowLeft className="h-5 w-5 text-gray-600 hover:text-black" />
|
||||
</button>
|
||||
<button data-glide-dir=">">
|
||||
<Icon.FiArrowRight className="h-5 w-5 text-gray-600 hover:text-black" />
|
||||
</button>
|
||||
<div className="glide__arrows ml-auto flex items-center gap-x-1" data-glide-el="controls">
|
||||
<SliderButton data-glide-dir="<">
|
||||
<Icon.FiArrowLeft className="h-5 w-5" />
|
||||
</SliderButton>
|
||||
<SliderButton data-glide-dir=">">
|
||||
<Icon.FiArrowRight className="h-5 w-5" />
|
||||
</SliderButton>
|
||||
</div>
|
||||
</div>
|
||||
<div className="glide__track" data-glide-el="track">
|
||||
|
||||
@@ -9,7 +9,6 @@ export const TrendingAppsSlider = <T extends App>({ items }: { items: T[] }) =>
|
||||
|
||||
return (
|
||||
<Slider<T>
|
||||
className="mb-16"
|
||||
title={t("trending_apps")}
|
||||
items={items.filter((app) => !!app.trending)}
|
||||
itemKey={(app) => app.name}
|
||||
|
||||
Reference in new issue
Block a user