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

fix: skeleton not using theme variables #9712

Merged
merged 3 commits into from
Jan 21, 2025
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
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import styled from '@emotion/styled';
import { motion } from 'framer-motion';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { ANIMATION, BACKGROUND_LIGHT, GRAY_SCALE } from 'twenty-ui';
import { ANIMATION } from 'twenty-ui';

import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
import { NAV_DRAWER_WIDTHS } from '@/ui/navigation/navigation-drawer/constants/NavDrawerWidths';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { useTheme } from '@emotion/react';
import { MainNavigationDrawerItemsSkeletonLoader } from '~/loading/components/MainNavigationDrawerItemsSkeletonLoader';

const StyledAnimatedContainer = styled(motion.div)`
Expand Down Expand Up @@ -47,6 +48,7 @@ const StyledSkeletonTitleContainer = styled.div`

export const LeftPanelSkeletonLoader = () => {
const isMobile = useIsMobile();
const theme = useTheme();

return (
<StyledAnimatedContainer
Expand All @@ -62,8 +64,8 @@ export const LeftPanelSkeletonLoader = () => {
<StyledItemsContainer>
<StyledSkeletonTitleContainer>
<SkeletonTheme
baseColor={GRAY_SCALE.gray15}
highlightColor={BACKGROUND_LIGHT.transparent.lighter}
baseColor={theme.background.tertiary}
highlightColor={theme.background.transparent.lighter}
borderRadius={4}
>
<Skeleton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { BACKGROUND_LIGHT, GRAY_SCALE } from 'twenty-ui';

const StyledSkeletonContainer = styled.div`
align-items: flex-start;
Expand All @@ -20,11 +20,13 @@ export const MainNavigationDrawerItemsSkeletonLoader = ({
title?: boolean;
length: number;
}) => {
const theme = useTheme();

return (
<StyledSkeletonContainer>
<SkeletonTheme
baseColor={GRAY_SCALE.gray15}
highlightColor={BACKGROUND_LIGHT.transparent.lighter}
baseColor={theme.background.tertiary}
highlightColor={theme.background.transparent.lighter}
borderRadius={4}
>
{title && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from '@emotion/styled';
import { BACKGROUND_LIGHT, GRAY_SCALE } from 'twenty-ui';
import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';

const StyledRightDrawerContainer = styled.div`
Expand All @@ -11,10 +11,12 @@ const StyledRightDrawerContainer = styled.div`
`;

const StyledSkeletonLoader = () => {
const theme = useTheme();

return (
<SkeletonTheme
baseColor={GRAY_SCALE.gray15}
highlightColor={BACKGROUND_LIGHT.transparent.lighter}
baseColor={theme.background.tertiary}
highlightColor={theme.background.transparent.lighter}
borderRadius={4}
>
<Skeleton height={SKELETON_LOADER_HEIGHT_SIZES.standard.m} width={140} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import {
BACKGROUND_LIGHT,
BORDER_COMMON,
BORDER_LIGHT,
GRAY_SCALE,
MOBILE_VIEWPORT,
} from 'twenty-ui';
import { BORDER_COMMON, MOBILE_VIEWPORT } from 'twenty-ui';

const StyledMainContainer = styled.div`
background: ${BACKGROUND_LIGHT.noisy};
background: ${({ theme }) => theme.background.noisy};
box-sizing: border-box;
display: flex;
flex: 1 1 auto;
Expand All @@ -27,8 +22,8 @@ const StyledMainContainer = styled.div`
`;

const StyledPanel = styled.div`
background: ${BACKGROUND_LIGHT.primary};
border: 1px solid ${BORDER_LIGHT.color.medium};
background: ${({ theme }) => theme.background.primary};
border: 1px solid ${({ theme }) => theme.border.color.medium};
border-radius: ${BORDER_COMMON.radius.md};
height: 100%;
overflow: auto;
Expand All @@ -54,11 +49,13 @@ const StyledRightPanelFlexContainer = styled.div`
`;

const StyledSkeletonHeaderLoader = () => {
const theme = useTheme();

return (
<StyledHeaderContainer>
<SkeletonTheme
baseColor={GRAY_SCALE.gray15}
highlightColor={BACKGROUND_LIGHT.transparent.lighter}
baseColor={theme.background.tertiary}
highlightColor={theme.background.transparent.lighter}
borderRadius={4}
>
<Skeleton
Expand All @@ -71,10 +68,12 @@ const StyledSkeletonHeaderLoader = () => {
};

const StyledSkeletonAddLoader = () => {
const theme = useTheme();

return (
<SkeletonTheme
baseColor={GRAY_SCALE.gray15}
highlightColor={BACKGROUND_LIGHT.transparent.lighter}
baseColor={theme.background.tertiary}
highlightColor={theme.background.transparent.lighter}
borderRadius={4}
>
<Skeleton width={132} height={SKELETON_LOADER_HEIGHT_SIZES.standard.s} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import styled from '@emotion/styled';
import { BACKGROUND_LIGHT, MOBILE_VIEWPORT } from 'twenty-ui';
import { MOBILE_VIEWPORT } from 'twenty-ui';

import { NAV_DRAWER_WIDTHS } from '@/ui/navigation/navigation-drawer/constants/NavDrawerWidths';
import { LeftPanelSkeletonLoader } from '~/loading/components/LeftPanelSkeletonLoader';
import { RightPanelSkeletonLoader } from '~/loading/components/RightPanelSkeletonLoader';

const StyledContainer = styled.div`
background: ${BACKGROUND_LIGHT.noisy};
background: ${({ theme }) => theme.background.noisy};
box-sizing: border-box;
display: flex;
flex-direction: row;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const SKELETON_LOADER_HEIGHT_SIZES = {

const SkeletonColumnLoader = ({ height }: { height: number }) => {
const theme = useTheme();

return (
<SkeletonTheme
baseColor={theme.background.tertiary}
Expand Down
Loading