Skip to content

Commit

Permalink
Refactor styling a bit to include opacity transition
Browse files Browse the repository at this point in the history
  • Loading branch information
marbiano committed Nov 4, 2020
1 parent 71fce97 commit caaf5ac
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion components/core/Featurebar/Featurebar.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.root {
@apply text-center p-6 bg-primary text-sm flex-row justify-center items-center font-medium fixed bottom-0 w-full z-30;
@apply text-center p-6 bg-primary text-sm flex-row justify-center items-center font-medium fixed bottom-0 w-full z-30 transition-all duration-300 ease-out;

@screen md {
@apply flex text-left;
Expand Down
16 changes: 8 additions & 8 deletions components/core/Featurebar/Featurebar.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import cn from 'classnames'
import { FC } from 'react'
import styles from './FeatureBar.module.css'

import s from './Featurebar.module.css'

interface Props {
interface FeatureBarProps {
className?: string
title: string
description?: string
hide?: boolean
action?: React.ReactNode
}

const Featurebar: FC<Props> = ({
const FeatureBar: React.FC<FeatureBarProps> = ({
title,
description,
className,
action,
hide,
}) => {
const rootClassName = cn(
s.root,
styles.root,
{
'transition-transform transform duration-500 ease-out translate-y-full': hide,
transform: true,
'translate-y-0 opacity-100': !hide,
'translate-y-full opacity-0': hide,
},
className
)
Expand All @@ -36,4 +36,4 @@ const Featurebar: FC<Props> = ({
)
}

export default Featurebar
export default FeatureBar
2 changes: 1 addition & 1 deletion components/core/Featurebar/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './Featurebar'
export { default } from './FeatureBar'
7 changes: 4 additions & 3 deletions components/core/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CommerceProvider } from '@bigcommerce/storefront-data-hooks'
import { useAcceptCookies } from '@lib/hooks/useAcceptCookies'
import { CartSidebarView } from '@components/cart'
import { Container, Sidebar, Button, Modal, Toast } from '@components/ui'
import { Navbar, Featurebar, Footer } from '@components/core'
import { Navbar, FeatureBar, Footer } from '@components/core'
import { LoginView, SignUpView, ForgotPassword } from '@components/auth'
import { useUI } from '@components/ui/context'
import { usePreventScroll } from '@react-aria/overlays'
Expand Down Expand Up @@ -54,7 +54,7 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
}
}, [handleScroll])

const handleAcceptCookies = () => {}
console.log(acceptedCookies)

return (
<CommerceProvider locale={locale}>
Expand All @@ -80,7 +80,7 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
{modalView === 'SIGNUP_VIEW' && <SignUpView />}
{modalView === 'FORGOT_VIEW' && <ForgotPassword />}
</Modal>
<Featurebar
<FeatureBar
title="This site uses cookies to improve your experience. By clicking, you agree to our Privacy Policy."
hide={acceptedCookies}
action={
Expand All @@ -89,6 +89,7 @@ const Layout: FC<Props> = ({ children, pageProps }) => {
</Button>
}
/>

{/* <Toast open={displayToast} onClose={closeModal}>
{toastText}
</Toast> */}
Expand Down
2 changes: 1 addition & 1 deletion components/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { default as Avatar } from './Avatar'
export { default as Featurebar } from './Featurebar'
export { default as FeatureBar } from './FeatureBar'
export { default as Footer } from './Footer'
export { default as Layout } from './Layout'
export { default as Navbar } from './Navbar'
Expand Down

0 comments on commit caaf5ac

Please sign in to comment.