Skip to content

Commit

Permalink
Merge pull request #1762 from natura-cosmeticos/DSY-3195
Browse files Browse the repository at this point in the history
Dsy 3195 -Codificar Template "Home" (JCB)
  • Loading branch information
Design-System-Natura authored Jul 10, 2023
2 parents 52fb37c + 5833156 commit af0cf65
Show file tree
Hide file tree
Showing 25 changed files with 1,123 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@naturacosmeticos/natds-react",
"displayName": "NatDS-React",
"description": "A collection of components from Natura Design System for React",
"version": "2.46.2-alpha.DSY-3452.1.0",
"version": "2.47.0-alpha.DSY-3195.3.0",
"private": false,
"keywords": [
"design-system",
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/Templates/Checkout/Checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const Checkout: React.FC = () => {
<CardSlide
prodTitle={elo.prodTitle}
brand={elo.brand}
theme={elo.theme}
code={elo.code}
point={elo.point}
price={elo.price}
Expand Down
4 changes: 3 additions & 1 deletion packages/react/src/Templates/Checkout/Targ/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const Targ: React.FC<BrandP> = ({
if (!brand) {
back = 'none'
}
const { container, targ, title } = styles({ back, top, size })
const { container, targ, title } = styles({
back, top, size, brand
})
return (
<div className={container}>
<div className={targ}>
Expand Down
12 changes: 11 additions & 1 deletion packages/react/src/Templates/Checkout/Targ/styles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-disable max-len */
import { createUseStyles } from 'react-jss'
import { Theme } from '@naturacosmeticos/natds-themes'
import { BrandProps } from '../../GlobalTypes'
import { buildTheme } from '../../../ThemeProvider'

type RuleNames =
| 'container'
Expand All @@ -9,6 +11,7 @@ type RuleNames =

export interface TargProps {
back: string
brand: BrandProps | undefined
top: number
size: 'small' | 'medium'
}
Expand All @@ -23,6 +26,13 @@ const handleSize = (size: string) => {
return 8
}
}
const getThemeSelect = (theme: Theme) => (brand: BrandProps | undefined) => {
const themeSelect = buildTheme(brand, 'light')
if (brand) {
return themeSelect.color.onPrimary
}
return theme.color.onPrimary
}

const styles = createUseStyles<RuleNames, TargProps, Theme>((theme: Theme) => ({
container: {
Expand All @@ -43,7 +53,7 @@ const styles = createUseStyles<RuleNames, TargProps, Theme>((theme: Theme) => ({
alignItems: 'center',
minWidth: ({ size }) => handleSize(size),
height: 16,
color: theme.color.onPrimary,
color: ({ brand }) => getThemeSelect(theme)(brand),
fontSize: 12,
borderRadius: [0, 4, 4, 0],
backgroundColor: ({ back }) => (back !== 'none' ? back : theme.color.primary)
Expand Down
3 changes: 3 additions & 0 deletions packages/react/src/Templates/Home/Home.props.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface HomeProps {
data?: [][]
}
25 changes: 25 additions & 0 deletions packages/react/src/Templates/Home/Home.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react'
import { Story, Meta } from '@storybook/react'
import Home from './Home'

const componentStatus = `
- - -
**NOTE FOR UXs**: This is exemplo template:
- - -
`

export default {
title: 'Templates/Home',
component: Home,
parameters: {
componentSubtitle: 'This is an example of implementing the theme on a Home page',
docs: { description: { component: componentStatus } }
}
} as Meta

export const Playground: Story = () => (

<Home />

)
185 changes: 185 additions & 0 deletions packages/react/src/Templates/Home/Home.styles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
/* eslint-disable max-len */
import { createUseStyles } from 'react-jss'
import { Theme } from '@naturacosmeticos/natds-themes'

const styles = createUseStyles((theme: Theme) => ({

container: {
display: 'flex',
fontFamily: [theme.tag.label.primary.fontFamily, theme.tag.label.fallback.fontFamily],
alignItems: 'center',
flexDirection: 'column',
border: ' 1px solid #0000001F',
gap: theme.size.micro,
// backgroundColor: theme.color.primary,
boxSizing: '-moz-initial',
maxWidth: 1280,
minWidth: 360,
width: '100%',
fontWeight: theme.typography.fontWeight.medium,
fontSize: theme.typography.fontSize.level2
},
containerSwitchTheme: {
display: 'flex',
width: '100%',
padding: 24,
boxSizing: 'border-box',
gap: 24
// border: '1px solid red'
// backgroundColor: '#FAFAFA'
},
containerSlides: {
display: 'flex',
flexDirection: 'column',
width: '100%',
padding: 24,
boxSizing: 'border-box',
gap: 24
// border: '1px solid red'
// backgroundColor: '#FAFAFA'
},
containerBanner: {
display: 'flex',
width: '100%',
height: 464,
padding: 0,
boxSizing: 'border-box',
backgroundColor: '#BBBBBB66'
},
wrapperBrandButtons: {
display: 'flex',
width: '100%',
padding: 0,
boxSizing: 'border-box',
gap: 16
// border: '1px solid red'
},
wrapperColumn: {
display: 'flex',
flexDirection: 'column',
width: '100%',
padding: 0,
boxSizing: 'border-box',
gap: 16
// border: '1px solid red'
},
containerTimeCounter: {
display: 'flex',
justifyContent: 'center',
width: '100%',
padding: 16,
height: 51,
backgroundColor: theme.color.surface,
boxShadow: '0px 1px 1px #00000024',
boxSizing: 'border-box',
// border: '1px solid red',
gap: 16
},
containerBody: {
display: 'flex',
width: '100%',
gap: 24,
// backgroundColor: '#FAFAFA',
flexDirection: 'column',
padding: 24,
boxSizing: 'border-box'

},
containerSection: {
display: 'flex',
width: '100%',
gap: 16
// backgroundColor: '#FAFAFA'
},
sectionSearchContainer: {
display: 'flex',
width: '100%',
gap: 1,
flexDirection: 'column'
},
containerStep: {
display: 'flex',
flex: 2,
justifyContent: 'center',
flexDirection: 'column',
// border: '1px solid red',
minHeight: '80px',
maxWidth: 920,
gap: 24
},
summaryContainer: {
display: 'flex',
// border: '1px solid red',
flex: 1,
maxWidth: '296px',
minHeight: '296px',
// alignItems: 'start',
flexDirection: 'column',
justifyContent: 'start',
backgroundColor: theme.color.surface,
gap: 4
},
containerSearch: {
display: 'flex',
flexDirection: 'column',
padding: 24,
boxSizing: 'border-box',
backgroundColor: theme.color.surface
},
banner: {
display: 'flex',
backgroundColor: '#BBBBBB66',
width: '100%',
height: '128px'
},
content: {
color: '',
fontFamily: [theme.tag.label.primary.fontFamily, theme.tag.label.fallback.fontFamily],
fontSize: theme.tag.label.fontSize,
fontWeight: theme.tag.label.primary.fontWeight,
letterSpacing: theme.tag.label.letterSpacing,
lineHeight: theme.tag.label.lineHeight,
userSelect: 'none',
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap'
},
TextRegular: {
fontWeight: theme.typography.fontWeight.regular,
fontSize: '14px',
color: theme.color.mediumEmphasis
},
'@media screen and (max-width: 1280px)': {
containerStep: {
display: 'flex',
justifyContent: 'center',
flexDirection: 'column',
// border: '1px solid yellow',
minHeight: '80px',
width: '100%',
gap: 24,
overflow: 'hidden'
},
containerSection: {
display: 'flex',
width: '100%',
gap: 16,
flexDirection: 'column-reverse',
justifyContent: 'center',
alignItems: 'center'
},
summaryContainer: {
display: 'flex',
width: '100%',
// alignItems: 'start',
maxWidth: 'unset',
minHeight: 'unset',
flexDirection: 'column',
justifyContent: 'start',
backgroundColor: theme.color.surface,
gap: 4
}
}
}))

export default styles
Loading

0 comments on commit af0cf65

Please sign in to comment.