Skip to content
Open
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
14 changes: 7 additions & 7 deletions playground/entries/Spin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ type AdditionalJSXProps = {
};
export type SpinJSXProps = JSXProps<NSSpin.Props> & AdditionalJSXProps;

const margins = {
xs: 1,
s: 1,
const gaps = {
xs: 1.5,
s: 1.5,
m: 2,
l: 2,
xl: 4,
Expand All @@ -32,10 +32,10 @@ const margins = {
const textSize: { [key in SpinJSXProps['size']]: NSText.Props['size'] } = {
xs: 200,
s: 200,
m: 300,
m: 200,
l: 300,
xl: 200,
xxl: 200,
xl: 300,
xxl: 300,
};

const textPlacement: { [key in SpinJSXProps['textPlacement']]: NSFlex.Props['direction'] } = {
Expand All @@ -46,7 +46,7 @@ const textPlacement: { [key in SpinJSXProps['textPlacement']]: NSFlex.Props['dir
function getJSX(props: SpinJSXProps) {
return props.text.length
? (
<Flex alignItems='center' gap={margins[props.size]} direction={textPlacement[props.textPlacement]}>
<Flex alignItems='center' gap={gaps[props.size]} direction={textPlacement[props.textPlacement]}>
<Spin size={props.size} theme={props.theme} />
<Text size={textSize[props.size]} color='text-secondary'>
{props.text}
Expand Down
17 changes: 1 addition & 16 deletions semcore/skeleton/src/Skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import type { NSSkeleton } from './Skeleton.type';
import style from './style/skeleton.shadow.css';
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';

const MAP_COLOR_THEME = {
dark: 'rgba(255, 255, 255, 0.3)',
invert: 'rgba(224, 225, 233, 0.8)',
};

class SkeletonRoot extends Component<
Intergalactic.InternalTypings.InferComponentProps<NSSkeleton.RenderComponent>,
typeof SkeletonRoot.enhance,
Expand Down Expand Up @@ -62,7 +57,7 @@ class SkeletonSVG extends Component<
static style = style;

static defaultProps = {
theme: 'invert',
theme: 'default',
duration: 2000,
} as const;

Expand Down Expand Up @@ -98,16 +93,6 @@ class SkeletonSVG extends Component<
}
}

setContext() {
const { theme } = this.asProps;

if (!theme) return {};

return {
gradientUrl: MAP_COLOR_THEME[theme],
};
}

render() {
const { Children, styles, uid, theme, duration } = this.asProps;
const SSkeletonSVG = Root;
Expand Down
15 changes: 5 additions & 10 deletions semcore/skeleton/src/Skeleton.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ declare namespace NSSkeleton {
duration?: string | number;
/**
* Skeleton theme
* @default invert
* @default default
*/
theme?: 'dark' | 'invert';
theme?: 'default' | 'invert';
/** Specifies the locale for i18n support */
locale?: string;
/**
Expand All @@ -26,12 +26,9 @@ declare namespace NSSkeleton {
*/
observeParentSize?: boolean;
};
type Ctx = {
gradientUrl: string;
};

type DefaultProps = {
theme?: 'invert';
theme: 'default';
duration: 2000;
};

Expand All @@ -48,18 +45,16 @@ declare namespace NSSkeleton {
type Component = Intergalactic.Component<'rect', Props>;
}

type RenderComponent = Intergalactic.Component<'div', Props, Ctx>;
type RenderComponent = Intergalactic.Component<'div', Props>;

type Component = Intergalactic.Component<'svg', Props, Ctx> & {
type Component = Intergalactic.Component<'svg', Props> & {
Text: Text.Component;
};
}

/** @deprecated It will be removed in v19. */
export type SkeletonProps = NSSkeleton.Props;
/** @deprecated It will be removed in v19. */
export type SkeletonCtx = NSSkeleton.Ctx;
/** @deprecated It will be removed in v19. */
export type SkeletonTextProps = NSSkeleton.Text.Props;

export type { NSSkeleton };
11 changes: 6 additions & 5 deletions semcore/skeleton/src/style/chart.shadow.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
SChartSkeleton {
height: 200px;
width: 100%;
background-image: var(--bgPattern);
mask-image: var(--bgPattern);
background-color: var(--intergalactic-skeleton-bg, oklch(0.94 0.002 180));
}

SChartSkeleton[bgPosition] {
background-position: var(--bgPosition);
mask-position: var(--bgPosition);
}

SChartSkeleton[bgSize] {
background-size: var(--bgSize);
mask-size: var(--bgSize);
}

SChartSkeleton[bgRepeat] {
background-repeat: var(--bgRepeat);
}
mask-repeat: var(--bgRepeat);
}
6 changes: 3 additions & 3 deletions semcore/skeleton/src/style/skeleton.shadow.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ SSkeleton {
}
}

SSkeletonSVG[theme='invert'] {
SSkeletonSVG[theme='default'] {
fill: var(--intergalactic-skeleton-bg, oklch(0.94 0.002 180));
}

SSkeletonSVG[theme='dark'] {
SSkeletonSVG[theme='invert'] {
fill: var(--intergalactic-skeleton-bg-invert, oklch(0.5 0.004 147.4));
}

Expand All @@ -36,4 +36,4 @@ SText {
SSkeleton {
animation-name: none;
}
}
}
2 changes: 1 addition & 1 deletion semcore/skeleton/src/svg/area-chart-linear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion semcore/skeleton/src/svg/area-chart-monotone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions semcore/skeleton/src/svg/bar-chart-horizontal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions semcore/skeleton/src/svg/bar-chart-vertical.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions semcore/skeleton/src/svg/bubble-chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 5 additions & 6 deletions semcore/skeleton/src/svg/compact-horizontal-bar-chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions semcore/skeleton/src/svg/donut-chart-halfsize.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 3 additions & 7 deletions semcore/skeleton/src/svg/donut-chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions semcore/skeleton/src/svg/histogram-chart-horizontal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions semcore/skeleton/src/svg/histogram-chart-vertical.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading