mrege
This commit is contained in:
commit
46f43159cd
|
|
@ -1,6 +1,6 @@
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import tw, { styled } from "twin.macro"
|
import tw, { styled } from "twin.macro"
|
||||||
import "styled-components/macro"
|
|
||||||
import { colors, colorsDisabled, colorsHover } from "./Colors"
|
import { colors, colorsDisabled, colorsHover } from "./Colors"
|
||||||
|
|
||||||
const BtnCreator = function ({ children, type, ...props }) {
|
const BtnCreator = function ({ children, type, ...props }) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import tw, {styled} from "twin.macro"
|
import tw, {styled} from "twin.macro"
|
||||||
import "styled-components/macro"
|
|
||||||
|
|
||||||
let Card = styled.div(tw`relative flex flex-col min-w-0 break-words bg-primary w-full shadow-xl rounded-2xl`)
|
let Card = styled.div(tw`relative flex flex-col min-w-0 break-words bg-primary w-full shadow-xl rounded-2xl`)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import tw, {styled} from "twin.macro"
|
import tw, {styled} from "twin.macro"
|
||||||
import "styled-components/macro"
|
|
||||||
|
|
||||||
|
|
||||||
export let colors = {
|
export let colors = {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { createPopper } from "@popperjs/core";
|
||||||
import { usePopper } from 'react-popper';
|
import { usePopper } from 'react-popper';
|
||||||
|
|
||||||
import tw, { styled } from "twin.macro"
|
import tw, { styled } from "twin.macro"
|
||||||
import "styled-components/macro"
|
|
||||||
|
|
||||||
import { colors, colorsDisabled, colorsHover, textColors, textColorsHover } from "./Colors";
|
import { colors, colorsDisabled, colorsHover, textColors, textColorsHover } from "./Colors";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import tw, { styled } from "twin.macro";
|
import tw, { styled } from "twin.macro";
|
||||||
import "styled-components/macro";
|
//import { useField as useFormikField, useFormikContext } from "formik";
|
||||||
import { useField as useFormikField, useFormikContext } from "formik";
|
const useFormikField = null;
|
||||||
|
const useFormikContext = ()=>{};
|
||||||
|
|
||||||
export function useField(props){
|
export function useField(props){
|
||||||
let getField = useFormikField;
|
let getField = useFormikField;
|
||||||
|
|
@ -15,7 +16,7 @@ export function useField(props){
|
||||||
return getField(props);
|
return getField(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Input({ label, title, className, children, ...props }) {
|
export default function Input({ label, title, children, className, ...props }) {
|
||||||
/*name, id*/
|
/*name, id*/
|
||||||
props.id = props.id ?? props.name ?? title;
|
props.id = props.id ?? props.name ?? title;
|
||||||
|
|
||||||
|
|
@ -48,15 +49,14 @@ export default function Input({ label, title, className, children, ...props }) {
|
||||||
export function TextArea({
|
export function TextArea({
|
||||||
label,
|
label,
|
||||||
title,
|
title,
|
||||||
className,
|
children,
|
||||||
children,
|
|
||||||
...props
|
...props
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
const [field, meta, helpers] = useField(props);
|
const [field, meta, helpers] = useField(props);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div css={[title && tw`my-1`]} className={className}>
|
<div css={[title && tw`my-1`]} >
|
||||||
{title && (
|
{title && (
|
||||||
<label
|
<label
|
||||||
{...label}
|
{...label}
|
||||||
|
|
@ -92,7 +92,7 @@ export function TextArea({
|
||||||
export function CheckBox({
|
export function CheckBox({
|
||||||
label,
|
label,
|
||||||
title,
|
title,
|
||||||
className,
|
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -100,7 +100,7 @@ export function CheckBox({
|
||||||
const [field, meta, helpers] = useField(props);
|
const [field, meta, helpers] = useField(props);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div tw="my-1 flex text-secondary" className={className}>
|
<div tw="my-1 flex text-secondary">
|
||||||
<input
|
<input
|
||||||
checked={field.value}
|
checked={field.value}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import tw, {styled} from "twin.macro"
|
import tw, {styled} from "twin.macro"
|
||||||
import "styled-components/macro"
|
|
||||||
|
|
||||||
const Full = styled.div(tw`w-full lg:px-2 py-2`)
|
const Full = styled.div(tw`w-full lg:px-2 py-2`)
|
||||||
export {Full}
|
export {Full}
|
||||||
|
|
||||||
const Half = styled.div(tw`w-full lg:w-6/12 lg:px-2 py-2`)
|
const Half = styled.div(tw`w-full lg:w-8/12 xl:w-6/12 lg:px-2 py-2`)
|
||||||
export {Half}
|
export {Half}
|
||||||
|
|
||||||
const Quarter = styled.div(tw`w-full lg:w-6/12 xl:w-3/12 lg:px-2 py-2 `)
|
const Quarter = styled.div(tw`w-full lg:w-6/12 xl:w-3/12 lg:px-2 py-2 `)
|
||||||
|
|
@ -14,7 +14,7 @@ export {Quarter}
|
||||||
const Sixth = styled.div(tw`w-full lg:w-1/5 xl:w-1/6 lg:px-2 py-2 `)
|
const Sixth = styled.div(tw`w-full lg:w-1/5 xl:w-1/6 lg:px-2 py-2 `)
|
||||||
export {Sixth}
|
export {Sixth}
|
||||||
|
|
||||||
const Third = styled.div(tw`w-full lg:w-4/12 lg:px-2 py-2 `)
|
const Third = styled.div(tw`w-full lg:w-8/12 xl:w-4/12 lg:px-2 py-2 `)
|
||||||
export {Third}
|
export {Third}
|
||||||
|
|
||||||
const TwoThird = styled.div(tw`w-full lg:w-8/12 lg:px-2 py-2 `)
|
const TwoThird = styled.div(tw`w-full lg:w-8/12 lg:px-2 py-2 `)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import React from "react"
|
||||||
import { Half, Third } from "./Layout"
|
import { Half, Third } from "./Layout"
|
||||||
|
|
||||||
import tw, { styled } from "twin.macro"
|
import tw, { styled } from "twin.macro"
|
||||||
import "styled-components/macro"
|
|
||||||
|
|
||||||
function Modal({ isOpen, onBackdropClick, ...props }) {
|
function Modal({ isOpen, onBackdropClick, ...props }) {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
import tw, { styled } from "twin.macro";
|
import tw, { styled } from "twin.macro";
|
||||||
import "styled-components/macro";
|
;
|
||||||
|
|
||||||
const Btn = styled(Button)(({ active }) => [tw`rounded-none mx-0`, active && tw`bg-accent`]);
|
const Btn = styled(Button)(({ active }) => [tw`rounded-none mx-0`, active && tw`bg-accent`]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import React, { useState, useEffect, useRef } from "react";
|
||||||
import styles from "./RangeSlider.scss"
|
import styles from "./RangeSlider.scss"
|
||||||
|
|
||||||
import tw from "twin.macro"
|
import tw from "twin.macro"
|
||||||
import "styled-components/macro"
|
|
||||||
|
|
||||||
|
|
||||||
export function RangeSlider({ value=0, rangeType="", onChange, min=0, max=10, right = true, ...props }) {
|
export function RangeSlider({ value=0, rangeType="", onChange, min=0, max=10, right = true, ...props }) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import tw, {styled} from "twin.macro"
|
import tw, {styled} from "twin.macro"
|
||||||
import "styled-components/macro"
|
|
||||||
|
|
||||||
export function Table(props) {
|
export function Table(props) {
|
||||||
return <div tw="block w-full overflow-x-auto text-secondary">
|
return <div tw="block w-full overflow-x-auto text-secondary">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import tw, {styled} from "twin.macro"
|
import tw, {styled} from "twin.macro"
|
||||||
import "styled-components/macro"
|
|
||||||
import { textColors, textColorsHover } from "./Colors"
|
import { textColors, textColorsHover } from "./Colors"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import React, { useState } from "react"
|
|
||||||
import { createGlobalStyle } from "styled-components"
|
import { createGlobalStyle } from "styled-components"
|
||||||
import tw, { theme, GlobalStyles as BaseStyles } from "twin.macro"
|
import tw, { theme, GlobalStyles as BaseStyles } from "twin.macro"
|
||||||
|
|
||||||
|
|
@ -68,7 +67,7 @@ body {
|
||||||
|
|
||||||
const GlobalStyles = () => {
|
const GlobalStyles = () => {
|
||||||
return <>
|
return <>
|
||||||
{/* <BaseStyles /> */}
|
<BaseStyles />
|
||||||
<CustomStyles />
|
<CustomStyles />
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
25
styledRegistry.js
Normal file
25
styledRegistry.js
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
'use client'
|
||||||
|
|
||||||
|
import React, { useState } from 'react'
|
||||||
|
import { useServerInsertedHTML } from 'next/navigation'
|
||||||
|
import { ServerStyleSheet, StyleSheetManager } from 'styled-components'
|
||||||
|
|
||||||
|
export default function StyledComponentsRegistry({ children }) {
|
||||||
|
// Only create stylesheet once with lazy initial state
|
||||||
|
// x-ref: https://reactjs.org/docs/hooks-reference.html#lazy-initial-state
|
||||||
|
const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet())
|
||||||
|
|
||||||
|
useServerInsertedHTML(() => {
|
||||||
|
const styles = styledComponentsStyleSheet.getStyleElement()
|
||||||
|
styledComponentsStyleSheet.instance.clearTag()
|
||||||
|
return <>{styles}</>
|
||||||
|
})
|
||||||
|
|
||||||
|
if (typeof window !== 'undefined') return <>{children}</>
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}>
|
||||||
|
{children}
|
||||||
|
</StyleSheetManager>
|
||||||
|
)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user