Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
fix: preset button
Browse files Browse the repository at this point in the history
  • Loading branch information
tangimds committed Oct 2, 2023
1 parent 063d246 commit 45f2dbe
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
38 changes: 18 additions & 20 deletions app/src/components/Button2.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,26 @@ const applyStyles = ({
...styles.base,
};

const applyIfNeeded = (cumStyles, condition, styleKey) => {
if (eval(condition)) {
cumStyles.button = { ...cumStyles.button, ...styles[styleKey].button };
cumStyles.container = {
...cumStyles.container,
...styles[styleKey].container,
};
cumStyles.text = { ...cumStyles.text, ...styles[styleKey].text };
cumStyles.icon = { ...cumStyles.icon, ...styles[styleKey].icon };
cumStyles.disabled = {
...cumStyles.disabled,
...styles[styleKey].disabled,
};
}
const applyIfNeeded = (cumStyles, styleKey) => {
cumStyles.button = { ...cumStyles.button, ...styles[styleKey].button };
cumStyles.container = {
...cumStyles.container,
...styles[styleKey].container,
};
cumStyles.text = { ...cumStyles.text, ...styles[styleKey].text };
cumStyles.icon = { ...cumStyles.icon, ...styles[styleKey].icon };
cumStyles.disabled = {
...cumStyles.disabled,
...styles[styleKey].disabled,
};
};

applyIfNeeded(appliedStyles, "preset==='primary'", "primary");
applyIfNeeded(appliedStyles, "preset==='secondary'", "secondary");
applyIfNeeded(appliedStyles, "type==='outline'", "outline");
applyIfNeeded(appliedStyles, "type==='clear'", "clear");
applyIfNeeded(appliedStyles, "size==='small'", "small");
applyIfNeeded(appliedStyles, "preset==='onboarding2'", "onboarding2");
preset === "primary" ? applyIfNeeded(appliedStyles, "primary") : null;
preset === "secondary" ? applyIfNeeded(appliedStyles, "secondary") : null;
type === "outline" ? applyIfNeeded(appliedStyles, "outline") : null;
type === "clear" ? applyIfNeeded(appliedStyles, "clear") : null;
size === "small" ? applyIfNeeded(appliedStyles, "small") : null;
preset === "onboarding2" ? applyIfNeeded(appliedStyles, "onboarding2") : null;

if (!fill && size === "default" && !square && !circle)
appliedStyles.button.minWidth = "70%";
Expand Down
2 changes: 1 addition & 1 deletion app/src/scenes/status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Status = ({ navigation }) => {
}

// si jamais fait de survey ? quepaso ?
console.log("✍️ diaryData:", diaryData);
// console.log("✍️ diaryData:", diaryData);
if (!diaryData) return;

if (computeNewSurveyAvailable(diaryData)) {
Expand Down

0 comments on commit 45f2dbe

Please sign in to comment.