Skip to content

${props.url} How do I do this without Styled Components? #1063

Answered by predaytor
BuchananQuantum asked this question in Help
Discussion options

You must be logged in to vote

You can create a wrapper with React.forwardRef.

Using styled:

import { styled } from 'stitches.config';
import type { CSS, VariantProps } from 'stitches.config';
import React from 'react';

const Component = styled('div', {
	height: '310px',
	// theme.colors.placeholder in config file
	backgroundColor: '$placeholder',
	backgroundPosition: 'center',
	backgroundZize: 'cover',

	variants: {},
	compoundVariants: [],
	defaultVariants: {},
});

type HeaderVariants = VariantProps<typeof Component>;
type HeaderProps = React.ComponentPropsWithRef<'div'> &
	HeaderVariants & { css?: CSS, url?: string };

export const Header = React.forwardRef<HTMLDivElement, HeaderProps>(
	({ url, css, ...props }, ref)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@predaytor
Comment options

@BuchananQuantum
Comment options

Answer selected by BuchananQuantum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants