Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

const padding = require("./padding");
const margin = require("./margin");
const prose = require("./prose");

module.exports = function (opts) {
padding(opts);
margin(opts);
prose(opts);
};
26 changes: 26 additions & 0 deletions lib/prose.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use strict";

module.exports = function ({ addUtilities, config, variants, theme }) {
let replaceProps = function (ulProps) {
const typographyCssArray = ulProps.css;
const typographyCss = typographyCssArray[0];
let ulPropsForRtl = typographyCss.ul;
ulPropsForRtl.paddingRight = ulPropsForRtl.paddingLeft;
ulPropsForRtl.paddingLeft = "unset";

return ulPropsForRtl;
};

const typographyProps = theme("typography");
const screenSizes = ["sm", "base", "lg", "xl", "2xl"];

const cssValues = new Map();
screenSizes.forEach((val) => {
const vName = `[dir=rtl] .prose-${val} :where(ul):not(:where([class~=\"not-prose\"] *))`;
cssValues.set(vName, replaceProps(typographyProps[val]));
});

cssValues.forEach((value, key) => {
addUtilities({ [key]: value });
});
};