Skip to content

Commit

Permalink
Half-fixing lingui code
Browse files Browse the repository at this point in the history
  • Loading branch information
Aisha Blake committed Apr 17, 2020
1 parent dafc548 commit 64f052a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
12 changes: 7 additions & 5 deletions www/src/components/layer-model/component-model/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,35 @@ import {
AppLayerContent,
} from "./component-content-sections"

import { t } from "@lingui/macro"

const layers = [
{
title: `Content`,
title: t`Content`,
icon: `AbstractSymbol`,
baseColor: `orange`,
component: ContentLayerContent,
},
{
title: `Build`,
title: t`Build`,
icon: `AtomicSymbol`,
baseColor: `green`,
component: BuildLayerContent,
},
{
title: `Data`,
title: t`Data`,
icon: `GraphqlLogo`,
baseColor: `magenta`,
component: DataLayerContent,
},
{
title: `View`,
title: t`View`,
icon: `ReactLogo`,
baseColor: `blue`,
component: ViewLayerContent,
},
{
title: `App`,
title: t`App`,
icon: `AppWindow`,
baseColor: `yellow`,
component: AppLayerContent,
Expand Down
10 changes: 6 additions & 4 deletions www/src/components/layer-model/image-model/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,29 @@ import {
DisplayLayerContent,
} from "./image-content-sections"

import { t } from "@lingui/macro"

const layers = [
{
title: `Install`,
title: t`Install`,
icon: `AbstractSymbol`,
baseColor: `orange`,
component: InstallLayerContent,
},
{
title: `Config`,
title: t`Config`,
icon: `AtomicSymbol`,
baseColor: `green`,
component: ConfigLayerContent,
},
{
title: `Query`,
title: t`Query`,
icon: `GraphqlLogo`,
baseColor: `magenta`,
component: QueryLayerContent,
},
{
title: `Display`,
title: t`Display`,
icon: `ReactLogo`,
baseColor: `blue`,
component: DisplayLayerContent,
Expand Down
8 changes: 5 additions & 3 deletions www/src/components/layer-model/layer-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import hex2rgba from "hex2rgba"

import { colors } from "gatsby-design-tokens/dist/theme-gatsbyjs-org"
import LayerIcon from "../../assets/icons/layer-icon"
import { Trans } from "@lingui/macro"

import { withI18n } from "@lingui/react"

const Layer = ({ buttonRef, layer, onClick, selected, index }) => {
const { baseColor, title, icon } = layer
Expand Down Expand Up @@ -52,7 +53,7 @@ const Layer = ({ buttonRef, layer, onClick, selected, index }) => {
fillColor={selected ? colors[baseColor][70] : colors.grey[50]}
/>
</span>
<span><Trans>{title}</Trans></span>
<span>{i18n._(title)}</span>
</span>
</button>
)
Expand All @@ -62,6 +63,7 @@ const LayerModel = ({
layers,
displayCodeFullWidth = false,
initialLayer = `Content`,
i18n,
}) => {
const [selected, setSelected] = useState(initialLayer)
const [sourceIndex, setSourceIndex] = useState(0)
Expand Down Expand Up @@ -137,4 +139,4 @@ const LayerModel = ({
)
}

export default LayerModel
export default withI18n()(LayerModel)

0 comments on commit 64f052a

Please sign in to comment.