Skip to content

Commit

Permalink
feat: ✨ add named_classes to easily overide styles
Browse files Browse the repository at this point in the history
  • Loading branch information
themashcodee committed Jan 25, 2024
1 parent 0b051e7 commit a2cf0fa
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 9 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"repository": "https://github.com/themashcodee/slack-blocks-to-jsx.git",
"license": "MIT",
"version": "0.0.8",
"version": "0.0.9",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -41,6 +41,7 @@
"@changesets/cli": "^2.26.2",
"@types/react": "17.0.0",
"@types/react-dom": "17.0.0",
"tailwindcss": "^3.4.1",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
}
Expand Down
178 changes: 178 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/components/blocks/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ export const Actions = (props: ActionsProps) => {
const { elements, block_id } = props.data;

return (
<div id={block_id} className="mb-2 text-primary flex w-full text-black-primary items-center">
<div
id={block_id}
className="mb-2 text-primary flex w-full text-black-primary items-center slack_blocks_to_jsx__actions"
>
<div className="flex flex-wrap">
{elements.map((element, i) => {
if (element.type === "button") {
Expand Down
2 changes: 1 addition & 1 deletion src/components/blocks/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const Context = (props: ContextProps) => {
return (
<div
id={block_id}
className="my-1 text-primary flex w-full text-black-primary flex-wrap items-center overflow-hidden"
className="my-1 text-primary flex w-full text-black-primary flex-wrap items-center overflow-hidden slack_blocks_to_jsx__context"
>
{elements.slice(0, 10).map((element, i) => {
if (element.type !== "image") {
Expand Down
5 changes: 4 additions & 1 deletion src/components/blocks/divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export const Divider = (props: DividerProps) => {
const { block_id } = data;

return (
<div id={block_id} className="border-b border-gray-primary border-solid w-full mt-1 mb-2"></div>
<div
id={block_id}
className="border-b border-gray-primary border-solid w-full mt-1 mb-2 slack_blocks_to_jsx__divider"
></div>
);
};
2 changes: 1 addition & 1 deletion src/components/blocks/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const Image = (props: ImageProps) => {
const [showImage, setShowImage] = useState(true);

return (
<div id={block_id} className="my-2 flex flex-col gap-2">
<div id={block_id} className="my-2 flex flex-col gap-2 slack_blocks_to_jsx__image">
<div className="text-black-secondary text-small flex gap-1 items-center">
<span>
{alt_text}
Expand Down
2 changes: 1 addition & 1 deletion src/components/blocks/section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const Section = (props: SectionProps) => {
return (
<div
id={block_id}
className={`mt-2 mb-1 text-primary flex w-full text-black-primary ${
className={`mt-2 mb-1 text-primary slack_blocks_to_jsx__section flex w-full text-black-primary ${
is_stacked ? "flex-col" : ""
}`}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/elements/button_element.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const ButtonElement = (props: TextObjectProps) => {
<button
id={action_id}
aria-label={accessibility_label}
className={`px-2 pt-0 pb-[1px] text-small h-[28px] min-w-[56px] border rounded whitespace-nowrap font-semibold ${
className={`px-2 pt-0 pb-[1px] text-small h-[28px] min-w-[56px] border rounded whitespace-nowrap font-semibold slack_blocks_to_jsx__button ${
style === "primary"
? "border-green-primary.3 text-green-primary"
: style === "danger"
Expand Down
2 changes: 1 addition & 1 deletion src/components/elements/checkboxes_element.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const CheckboxesElement = (props: TextObjectProps) => {
}, [focus_on_load]);

return (
<div id={action_id} className="my-1 flex w-full">
<div id={action_id} className="my-1 flex w-full slack_blocks_to_jsx__checkboxes">
<fieldset className="flex flex-col gap-2">
{options.map((option, i) => {
const { text, value, description } = option;
Expand Down
Loading

0 comments on commit a2cf0fa

Please sign in to comment.