Skip to content

Commit

Permalink
Fix text styles inside internationalization nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
pascaionut12345 committed Dec 10, 2024
1 parent c38fc24 commit 1efa5e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/teleport-plugin-css-modules/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export const createCSSModulesPlugin: ComponentPluginFactory<CSSModulesConfig> =
const referedStyle = globalStyleSheet[content.referenceId]
if (!referedStyle) {
throw new PluginCssModules(
`Style used from global stylesheet is missing - ${content.referenceId}`
`Style used from global stylesheet is missing plugin css module - ${content.referenceId}`
)
}
classNamesToAppend.add(
Expand Down
2 changes: 1 addition & 1 deletion packages/teleport-plugin-react-jss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export const createReactJSSPlugin: ComponentPluginFactory<JSSConfig> = (config)
const referedStyle = projectStyleSet.styleSetDefinitions[content.referenceId]
if (!referedStyle) {
throw new PluginReactJSS(
`Style used from global stylesheet is missing - ${content.referenceId}`
`Style used from global stylesheet is missing plugin react jss - ${content.referenceId}`
)
}

Expand Down
12 changes: 9 additions & 3 deletions packages/teleport-project-plugin-i18n-files/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ProjectPluginStructure,
ProjectType,
UIDLElementNode,
UIDLStyleSetDefinition,
} from '@teleporthq/teleport-types'
import {
createJSXSyntax,
Expand All @@ -28,7 +29,10 @@ export class ProjectPlugini18nFiles implements ProjectPlugin {
this.resolver = new Resolver(ReactMapping)
}

async generateJSX(node: UIDLElementNode): Promise<{ html: string; css?: string }> {
async generateJSX(
node: UIDLElementNode,
projectStyleSet: Record<string, UIDLStyleSetDefinition>
): Promise<{ html: string; css?: string }> {
const proxyUIDL: ComponentUIDL = {
name: 'locale-node',
node,
Expand Down Expand Up @@ -73,7 +77,9 @@ export class ProjectPlugini18nFiles implements ProjectPlugin {
},
],
dependencies: {},
options: {},
options: {
projectStyleSet: { styleSetDefinitions: projectStyleSet, fileName: '', path: '' },
},
}

const result = await createCSSPlugin({
Expand Down Expand Up @@ -113,7 +119,7 @@ export class ProjectPlugini18nFiles implements ProjectPlugin {
if (item?.type === 'element') {
promises.push(
new Promise((resolve) => {
this.generateJSX(item).then(({ html, css }) => {
this.generateJSX(item, uidl.root.styleSetDefinitions).then(({ html, css }) => {
resolve({ [id]: css ? `${html} \n <style>${css}</style>` : html })
})
})
Expand Down

0 comments on commit 1efa5e5

Please sign in to comment.